ark-lang / ark

A compiled systems programming language written in Go using the LLVM framework
https://ark-lang.github.io/
MIT License
677 stars 47 forks source link

Local named scope-thingies #660

Open felixangell opened 8 years ago

felixangell commented 8 years ago

No idea what the name is for these, so sorry for the bad title... @kiljacken suggested this on IRC and I'm pretty certain we all agreed on this feature, so here goes at "documenting it".

Basically it's a scope that does something and will yield a result, supposedly this is useful for things like RAII, the syntax looks something like this:

x := {
     ...
     yield baz;
};
// x is now baz

I'm wondering what the type is for this thing because here we infer the type, I'm gonna take a hit in the dark and assume we infer it based on the value that the scope yields?