aristanetworks / aristanetworks/purescript-backend-optimizer

Add support for re-exports in codegen.

Open
#5 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
PureScript
Stars
216
Forks
24
Avg merge
8m
Merged PRs (30d)
2

Description

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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in codegen and trace how the compiler's CoreFn CSE pass creates top-level bindings, using the Aff `try` example as the concrete case. Check how re-exports and private bindings are named, then verify that private bindings use the proposed `$priv` distinction and no duplicate export remains.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.