You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow definition macro protocol to communicate the defined names #556
It would be useful if definition macros could communicate the defined names in some way. For example, consider a definition macro pub that chains to another definition(s) and makes all defined names exported by default. Currently, I see no way to parse definitions within a definition context, so I hope this can be incorporated once the protocol is thought out.
I haven't pursued this idea, because it seems like requiring definition macros to report their defined names would be too much of a burden on macro authors, and extracting defined names automatically post-expansion runs into usual expansion-order constraints with definitions.
The export definition form does extract definitions automatically (an in a hygiene-bending way #719), but only because it gets help from the definition-sequence expander and namespace forms. The export form is not handled by immediately forcing expansion, but instead by injecting "start" and "end" operators before and after the definition, so that the definition-sequence expander to gather all the names it sees in between, and then it delivers them to the enclosing context (which is expecting to be told about exported names).
So, my current impression is that this feature isn't something we can have without giving up other things that Rhombus already relies on.
Activity
mflatt commentedon Dec 7, 2025
I haven't pursued this idea, because it seems like requiring definition macros to report their defined names would be too much of a burden on macro authors, and extracting defined names automatically post-expansion runs into usual expansion-order constraints with definitions.
The
exportdefinition form does extract definitions automatically (an in a hygiene-bending way #719), but only because it gets help from the definition-sequence expander and namespace forms. Theexportform is not handled by immediately forcing expansion, but instead by injecting "start" and "end" operators before and after the definition, so that the definition-sequence expander to gather all the names it sees in between, and then it delivers them to the enclosing context (which is expecting to be told about exported names).So, my current impression is that this feature isn't something we can have without giving up other things that Rhombus already relies on.