Open
Description
The user may write:
let x = xdef
y = ydef
xyscope
for brevity. Of course, this isn't a lazy language, so xdef
cannot actually reference y
and ydef
cannot actually reference x
, but so long as that is the case, this is semantically equivalent to writing:
let x = xdef
let y = ydef
xyscope
Indeed, LowerAst
will only work on the second form but not the first. We need to implement a desugaring pass that does this for us.
Furthermore, something like:
let f x = if x { h x } else { () }
g x = if x { h x } else { () }
h x = if x { g x } else { () }
fghscope
can also be partially sequentialized:
let g x = if x { h x } else { () }
h x = if x { g x } else { () }
let f x = if x { h x } else { () }
fghscope
This may make type-checking/inference much easier, depending on how mutual recursion is deal with, so this is something we would want done too.
In summary:
- sequentialize parallel variable bindings
- best-effort sequentialize parallel function bindings