aristanetworks / purescript-backend-optimizer

Optimizing backend toolkit and modern ECMAScript backend for PureScript
MIT License
201 stars 18 forks source link

Remove rewrite-based let floating #85

Closed natefaubion closed 1 year ago

natefaubion commented 1 year ago

Moving completely to eval.

natefaubion commented 1 year ago

cc @mikesol

natefaubion commented 1 year ago

This does not attempt to add any additional let floating, just replace the existing let floating. Anything that was evalAssocLet (let floating) is now floatLet.

natefaubion commented 1 year ago

Related to (1), would it make sense for all of the let floating to happen in eval? I say this from a maintainability perspective: if it's nestled down in functions like evalUpdate, it's more difficult to reason about why the call happens there & not elsewhere. Alternatively, if it needs to be that far down, it'd be good to leave a comment above the function about why floating happens where it happens & the reason certain things make the cut for floating but not others.

Not everything goes through eval directly. eval turns Syntax into Semantics, but if you are already in Semantics (such as in foreign modules) what are you to do? The let floating is still necessary, so the only solution is to put it with the actual interpretation routines.