Eliminate the special treatment of Top by making all let-likes "in" expressions. Inject a new Export AST node at the end of the file – and thus the deepest point in the tree. This exports all defined names to allow importing to work. Language is now less rigid and allows functions and imports to be anywhere. However, pragmas must now be at the top. These are extracted by the parser instead of the runtime and so must be simple literal AST nodes (a single number, string, etc.).
Eliminate the special treatment of
Top
by making all let-likes "in" expressions. Inject a newExport
AST node at the end of the file – and thus the deepest point in the tree. This exports all defined names to allow importing to work. Language is now less rigid and allows functions and imports to be anywhere. However, pragmas must now be at the top. These are extracted by the parser instead of the runtime and so must be simple literal AST nodes (a single number, string, etc.).