Closed lojikil closed 1 year ago
Oh, I lied, it's an interaction with the tail call rewriter: # debugging: shadow_l = _1 l;
which is clearly the function call -> while loop rewriter. Interesting.
Ja, let's look at this around line 405 in carpet/cg/compiler
as well as around line 397; the fix for both should be to actually just assign to the frame, and allow the spaghetti stack to take care of both.
Interesting, the EnvironmentFrame
is definitely getting a ton of garbage added to it:
# compiling: ../sandcity/list-test.coast
# in is_accessor with: _0
# <class 'carpet.util.spaghetti.SpaghettiStack'> <class 'carpet.util.spaghetti.SpaghettiStack'>
# [[[[[[[], []], {}], {}], {}], {}]]
This makes me want to rewrite the whole thing in something else 😭
A fair number of those are likely from us env.variables += ...
the returns from other functions into the variable space, I wonder if that's part of the issue: something is returning a dict whereas we thought it would be returning a list...
Honestly, thinking about this more, we probably should also separate out the two phases:
This is definitely still an issue, but I've been using nopython
for the self-hosting compiler, and probably would prefer to do that over digging into this here...
lifting a
case
form with some type constructors errors out:The minimal test case:
and the result:
The it's definitely an assumption from when I was building the original
case
code after lifting the form to a binding, and it's an interaction with how we handle bothcase
forms with a function call as the condition as well ascase
forms with constructor cases.