buzz-language / buzz

👨‍🚀 buzz, A small/lightweight statically typed scripting language
https://buzz-lang.dev
MIT License
1.15k stars 31 forks source link

Don't handle `OutOfMemory` errors #159

Closed giann closed 9 months ago

giann commented 11 months ago

We could get rid of 70% of error handling code in buzz if we just @panic when OutOfMemory. I see no value in handling those.

daurnimator commented 10 months ago

I'm totally out of the loop on buzz right now; but being able to handle Out Of Memory is invaluable.

giann commented 10 months ago

I don't know. In a garbage collected language what could you do to recover memory? Isn't it pretty much game over when you're out of memory?

daurnimator commented 8 months ago

In a garbage collected language what could you do to recover memory?

Isn't it pretty much game over when you're out of memory?

If you fail to do either of the above (or don't want to), then throw an error. Throwing the error will unwind the stack to the next try/catch and probably free up some references to some objects that can now be freed.

Now in a CLI tool there there might not be a try/catch other than simply printing the error and exiting. But in e.g.