Open macchiati opened 8 months ago
We should consider this in a severely timeboxed way. Bear in mind design, which is not directly "on the nose" to this request.
Note that unquoted literals appear in other places than in keys. We previously reserved a bunch of the ASCII punctuation (which is the main consideration here) for future use via reserved-statement
. Removing that from the syntax does not mean that we should pilfer the box for more of these characters. Things that spoof sigils in appearance are probably a Bad Idea.
For example, one of the characters not listed above is :
, which is the function introducer and namespace separator. It can't be in an unquoted. #
and /
probably need to be avoided because of markup. And @
because of attributes.
On the other hand, square brackets and parens seems potentially useful as do some of the other junk.
This won't go in 46.1, so I'm going to change the labels. I am also adding resolve-candidate because I think we won't extend unquoted, but that's for the WG to decide.
One comment; broadening can be done in future versions, since it would be backwards compatible.
Broadening can be done, so long as it is done in a backwards-compatible way. It's a little tricky here, because of the uses of literals in the syntax. I haven't carefully reviewed the proposal recently enough to say one way or the other if there are sticky bits that I'd object to. I won't say that we would never do an extension (never is a long time), but I think it unlikely in the 2.0 timeframe (e.g. 46.1/47)
Summary
Consider relaxing constraints on literals, after v45
Background
Right now, unquoted literals are fairly narrowly constrained by message.abnf ; here are the relevant lines:
Reason for reconsidering
However, for functions outside of the standard registry, this forces many natural literals to use quotes. Here is an example from a function that would handle MF1’s choice format:
The natural literals to use would be intervals, which use [,(,),] characters for ranges (the choice format would require some recasting because it depends on ordering of variants. It currently uses >.) So that would require
Many Unicode symbols are included by XML’s NT-NCName (about 6,000 currently), while many are excluded (about 2,600 currently). But these are literals, not identifiers, which is what name is intended for. By expanding beyond identifier usage, it allows functions to avoid requiring quoting in many cases. It also allows us to dispense with the special formulation for number-literal.
The literals for number, date, etc could be specified elsewhere, but wouldn’t have to be in the ABNF.
That would allow for various registries to have more sophisticated literal without requiring quoting, and without privileging the structured literals that we know about now.
Requirements
So, what restrictions on characters for a broadened definition of unquoted literals would be required by a revised ABNF?
No ‘}’, because it would make .local \$x = {literal} fail.
No ‘|’, because an initial one would conflict with quoting, and it is best to just forbid it anywhere in an unquoted literal to prevent confusion.
No ‘{’. Not strictly required, but for clarity wherever used.
None of the big blocks of ‘strange’ code points that XML forbids: controls, surrogates, private-use, noncharacters.
These are all immutable (Unicode Character Encoding Stability).
This also disallows the noncharacters that XML didn’t know about yet, before the noncharacter property was made immutable.
No whitespace, since variant uses that for separators between keys.
This could be done by just disallowing the “s” production characters, but that could be very confusing. {a b} looks too much like two items (the space is an A0 NO-BREAK SPACE). So it should be broadened to the Unicode Whitespace characters.
Unicode Whitespace is not guaranteed immutable, but has not changed for over a decade. Anyway, we would derive the code points as of now, so everything would be stable into the future.
(Any others?)
Not coincidentally, 2-3 are the characters in the reserved-escape production.
Detailed Proposal
This would result in the following change:
OLD
NEW
Needed to avoid syntax conflicts
Whitespace
Controls
Surrogates
Private Use
Noncharacters