I wonder to what extent interpreter suppose to evaluate things?
Is it for memory reduction or expansion as well? Like, 1 + 2
transforms two numbers to a single number 3
. But interpretation of List.repeat(42, 100)
expands memory (from two numbers to 100
numbers in plain list).
And recursion evaluation may hang.
So what are the limits? Or do we want to find them empirically?
yeah I think we want to always evaluate
if it expands the binary and you don't want it to do that, you can always wrap it in a thunk
Ah, so the interpreter skips lazy evaluations. Makes sense
I do think we could make the compiler print out updates though:
Warning: compiler has looped N times on the same branch (print line of code or function recured on). This might be infinite recursion.
Or something like that
Also, might be worth printing a warning if you make a gigantic list that is blowing up executable size.
I think there could be a few of these
Just to inform users who might not inderstand
I think it would be easy to make a gigantic constant and not realize the cost.
Hopefully long term, the expensive constants can also be cached in a way that avoids recomputing them even on module recompulation
But anyway...thoughts are just long term ideas
Last updated: Jul 26 2025 at 12:14 UTC