refaktor / rye

homoiconic dynamic programming language with some new ideas
https://ryelang.org
Apache License 2.0
400 stars 21 forks source link

defer? #259

Open noonien opened 1 month ago

noonien commented 1 month ago

Concurrency examples use a waitgroup, but have to do wg .done at the end of the function. This is not a problem if there are no returns, but once there are multiple returns, the user has to have a wg .done before each return.

Due to how functions are created, I'm guessing implementing defer is not very complicated and would add a lot of value, with IO as well.

refaktor commented 1 month ago

Frankly, I haven't taken the time to figure out how defer works internally in Go and if we could use that or "simulate" on our own side. I will check it out, thanks!