novika-lang / novika

🪱 Novika is a free-form, moldable, interpreted programming language
https://novika-lang.github.io/
MIT License
15 stars 0 forks source link

Bug: unhandled nested death infinite loop #68

Open homonoidian opened 1 year ago

homonoidian commented 1 year ago

[ [ die ] open ] @: *died foo to repro

Sometimes can crash the interpreter.

Doesn't skip dh unless in it!

homonoidian commented 1 year ago

Too hard for 0.0.6, been stuck trying to solve this for a few days and stuck still.

I'm starting to think that the existence of *died is wrong rather than the fact it doesn't work in certain cases. But it's pretty hard to come up with an alternative: *died is not about returning ok, result or crap like that, it's about catching errors coming mainly from "the deep below", namely the native code part of the language.

I see how the use of Crystal exceptions & begin..rescue can be eliminated, sure (and that's what should be done when I feel like it). But this particular problem...

Death handler lookup is extremely hard in Novika. It'd be easier to have a neural network guess the right block to use rather than to devise an algo by hand... That's what I'm talking about: perhaps it is the very existence of *died that is wrong rather than the peculiarities of its shitty implementation? If it requires a shitty implementation, perhaps it's not what the language needs?

The amount of code to rewrite if I do come up with an alternative tho... Better I don't, damn!