awestlake87/helix

'with' context managers

Opened this issue · 1 comments

struct Context
    oper construct():
        print("enter context")

    oper destruct():
        print("exit context")

%context_manager
coro use_coro_as_context()
    print("enter coro context")
    yield
    print("enter coro context")

with ctx: Context() 
    // enter context
    pass
// exit context

with use_coro_as_context()
    // enter coro context
    pass
// exit coro context

this may make things more clear, but it's not really necessary because Meta has destructors