Add export directive#2697
Conversation
66905ff to
e8f347f
Compare
Co-authored-by: Restyled.io <commits@restyled.io>
There was a problem hiding this comment.
Great! 👍
I don't like export in that much, it feels like forward declarations in C, but backwards. Could we have a syntax for def/tydef?
export def foo = 1 end
export tydef Bar b = (b,b) end
to desugar to:
def foo = 1 end;
export foo;
tydef Bar b = (b,b) end;
export Bar;
EDIT: Ah, after reading the comment in go I see that is not how it works. Maybe the name should be reexport?
|
@xsebek Yeah, the In any case, That is, every I think |
Merge Queue Status
This pull request spent 11 seconds in the queue, including 1 second running CI. Required conditions to merge
|
|
I went ahead and merged this but happy to still entertain ideas for making it better! |
Adds a new
exportconstruct for better control over module exports.export "foo" in ...imports the module"foo"(just likeimport) and also re-exports it in its entirety. This is actually parsed as animportwith a special "re-export" flag set.export x in ...causes the namexto be exported (which must be in scope).This PR also replaces the generic strict
Pairwith a custom data typeModuleExports.Related features which we could either leave to a subsequent PR, or possibly address here if there is a consensus on a nice design:
tydefs in addition todefs. Currentlyexport xonly works on value-level names.defin a module is exported by default.Closes #2664.