Skip to content

Allow definition macro protocol to communicate the defined names #556

Open

Description

@usaoc

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.

Activity

  1. mflatt commented on Dec 7, 2025

    @mflatt
    Member

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions