Stream: compiler development

Topic: interpreter


view this post on Zulip Kiryl Dziamura (Jul 20 2025 at 08:34):

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?

view this post on Zulip Richard Feldman (Jul 20 2025 at 11:06):

yeah I think we want to always evaluate

view this post on Zulip Richard Feldman (Jul 20 2025 at 11:07):

if it expands the binary and you don't want it to do that, you can always wrap it in a thunk

view this post on Zulip Kiryl Dziamura (Jul 20 2025 at 11:49):

Ah, so the interpreter skips lazy evaluations. Makes sense

view this post on Zulip Brendan Hansknecht (Jul 20 2025 at 13:37):

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

view this post on Zulip Brendan Hansknecht (Jul 20 2025 at 13:38):

Also, might be worth printing a warning if you make a gigantic list that is blowing up executable size.

view this post on Zulip Brendan Hansknecht (Jul 20 2025 at 13:38):

I think there could be a few of these

view this post on Zulip Brendan Hansknecht (Jul 20 2025 at 13:39):

Just to inform users who might not inderstand

view this post on Zulip Brendan Hansknecht (Jul 20 2025 at 13:41):

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

view this post on Zulip Brendan Hansknecht (Jul 20 2025 at 13:41):

But anyway...thoughts are just long term ideas


Last updated: Jul 26 2025 at 12:14 UTC