Skip to content

Allow to export values with invalid OCaml names #713

@jchavarri

Description

@jchavarri

At the moment, all values exported from the structure items of a module need to comply with OCaml ident spec:

ident ::= (letter ∣ _) { letter ∣ 0…9 ∣ _ ∣ ' } 

But sometimes, it is useful to export ids with names starting with uppercase (like for NextJS routes) or starting with numbers, etc.

In ReScript, this was solved at the parsing level allowing for illegal identifiers (example). A solution like this is probably not possible in Melange, as compatibility with Reason and OCaml parsers (or at least the latter) is required, but maybe a solution with PPX attributes is possible?

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