yona-lang / yona

Yona is a modern take on a dynamic general-purpose programming language with advanced functional programming, minimalistic ML-like syntax, strict evaluation, for GraalVM polyglot virtual machine (VM).
https://yona-lang.org/
GNU General Public License v3.0
127 stars 6 forks source link

Context managers #33

Closed akovari closed 4 years ago

akovari commented 4 years ago

Introduce a new type of with expression. This expression will allow accessing and manipulating local context variables within the expression in the body of the with expression.

Standard library module will be necessary to allow reading/writing context variables.

Syntax

with <expr1> (as <identifier>)?
<expr2>
end

Usecases

Further considerations

akovari commented 4 years ago

@kurobako I'm thinking about something like this:

akovari commented 4 years ago

Documented in https://yatta-lang.org/docs/resource-management/