aristanetworks/purescript-backend-optimizer

Add support for re-exports in codegen.

Opened this issue · 0 comments

Currently we do not emit re-exports in codegen (purs does). This is because nothing is really private. Through inlining, we need to be able to refer to top-level bindings that were not explicitly exported. This conflicts with the naming scheme. used in the compiler's CoreFn CSE pass.

An example from Aff is try. It re-exports try, but the CSE pass also creates a top-level binding named try, which has a dictionary applied. We can't export both under the same, and this leads to a duplicate export error.

In order to fix this, we need to rename private top-level bindings during codegen, probably with a $priv suffix.