tj / luna

luna programming language - a small, elegant VM implemented in C
2.45k stars 147 forks source link

Google Go `defer` ? #38

Open yields opened 11 years ago

yields commented 11 years ago

I know the project hasn't reached that point yet, what do you think on Go's defer.

tj commented 11 years ago

pretty cool, although I think most functions with lots of return statements could/should be separated, same with lots of branches

DAddYE commented 11 years ago

What instead about channels ?

tj commented 11 years ago

I definitely want first-class coroutines, so those would effectively be our channels but im not sure how Go specifics. I know they multiplex kernel threads, I'd prefer not to go down that road if we dont need to, personally I dont see the reasoning behind that when you can just spawn N processes and coroutines handle all the concurrency. Whereas with Go I imagine you'd just tell Go you want to consume N cpus, more or less the same thing with maybe a bit less memory usage