effekt-lang / effekt

A language with lexical effect handlers and lightweight effect polymorphism
https://effekt-lang.org
MIT License
334 stars 24 forks source link

Allocate region variables as "local variables" on previous stack #642

Closed serkm closed 3 weeks ago

serkm commented 1 month ago

@phischu I hate how this turned out.

When allocating into a region, we cannot know the answer type of that region. This makes it impossible to push a regular return address.

As a workaround, variables are allocated with a special return function, that removes the region from the stack. When underflowing a region, we first call this special function, and then return regularly.

Also, this breaks globals, as the first stack has no previous stack.

serkm commented 1 month ago

The last commit depends on #651