ursalang / ursa

A friendly, stable general-purpose programming language
https://ursalang.github.io
3 stars 1 forks source link

In `symRef`, `ArkStackRef`s with non-zero `level` only exist transiently (until converted into captures) #43

Closed rrthomas closed 7 months ago

rrthomas commented 7 months ago

So, remove field level from ArkStackRef and produce captures directly. Also, it's unnecessary to compute the values of free variables, we should just record their names, i.e. Frame.captures.

ArkFn needs to get its captures as an array of ArkExp supplied by calling symRef on the names of the captures. That removes the for loop from symRef. The caller of ArkFn also needs to compile code to evaluate the captures (i.e. pass the names to symRef), and pass those exps to the constructor of ArkFn.