Skip to content

Allow names to start with a digit #350

@aphillips

Description

@aphillips

Is your feature request related to a problem? Please describe.
Currently names can start with a potpourri of characters:

name-start = ALPHA / "_"
           / %xC0-D6 / %xD8-F6 / %xF8-2FF
           / %x370-37D / %x37F-1FFF / %x200C-200D
           / %x2070-218F / %x2C00-2FEF / %x3001-D7FF
           / %xF900-FDCF / %xFDF0-FFFD / %x10000-EFFFF

... but ASCII digits are not permitted. Note that the above ranges include digits in a variety of writing systems, including the wide compatibility digits starting at 0xFF21. Just not ASCII digits.

This could be a compatibility problem. Existing MF1 messages can use numbered names, i.e. this is valid:

You have {0} foo on {1}

But this is not valid MF2:

You have {$0} foo on {$1}

Describe the solution you'd like
Add DIGIT to the name-start list (or actually convert ALPHA to alnum)

Describe why your solution should shape the standard
This is a restriction in the standard and thus cannot be part of userland.

Additional context or examples
Use of numbered replacements is super-common in existing messaging schemes, including printf type syntaxes and the existing message format. While we require users to add our sigals and decorations when converting, the omission of digits at name start requires developers to go beyond that and actually name all of their replacement variables.

Implementations that allow auto-numbered arg lists (similar to MF1) would be seriously inconvenienced by having to change to names-in-a-map. (I had one of these implementations)

I cannot think of a reason why numbers are not allowed? They don't appear to present a parsing hazard of any kind and the name production is always marked with a sigal ($ or : etc.) anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    syntaxIssues related with syntax or ABNF

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions