-
-
Notifications
You must be signed in to change notification settings - Fork 36
Change the syntax of the ::open and :/close function calls #397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This is an alternative to unicode-org#397, which I'd like to collect feedback on. main: {+button title=|Click me!|}Submit{-button} unicode-org#397: {::button title=|Click me!|}Submit{:/button} this: {\button title=|Click me!|}Submit{/button} It's an attempt to find a pair of convenient single-char-long prefixes which don't conflict with signed number literals. The opening syntax, `\func`, is inspired by TeX. The closing syntax, `/func`, is inspired by HTML.
This is a follow-up to unicode-org#364, which made it possible to use unquoted literals in the argument position in placeholders. However, due to the current syntax of +open and -close function calls, arguments that are number literals must still be quoted, e.g. `{|-1| :number}`. This PR proposes to change the syntax of markup-like function calls: BEFORE: {+button title=|Click me!|}Submit{-button} AFTER: {::button title=|Click me!|}Submit{:/button} The benefit of using a two-char-long prefix is that we effectively establish the colon `:` as the general-purpose function introducer.
This is an alternative to unicode-org#397, which I'd like to collect feedback on. main: {+button title=|Click me!|}Submit{-button} unicode-org#397: {::button title=|Click me!|}Submit{:/button} this: {\button title=|Click me!|}Submit{/button} It's an attempt to find a pair of convenient single-char-long prefixes which don't conflict with signed number literals. The opening syntax, `\func`, is inspired by TeX. The closing syntax, `/func`, is inspired by HTML.
To qualify this a bit, only literals that represent negative numbers must be quoted with our current syntax; for example
is completely fine. I also continue to be interested in having anyone provide examples of existing real-world messages in any format that include negative number literals in any form. I contend that this is an exceedingly rare usage pattern that should not drive our syntax deliberations. For one real-world data point, much of the Firefox code base is formatted with Fluent, which also supports markup as well as numerical literals as formatting function arguments and option values. It currently uses markup in a little under 5% of all messages, and does not include a single negative number literal. |
@eemeli I don't think that percentages of messages is that useful a measure. The majority of strings have no replacements. The majority of strings with placeables have only one. Etc. What does concern me in this case is the "accessibility" or "usability" of the features we build: how surprising or unsuprising are the features? How consistent are they? I think for negative numbers, there are domains where they are more prevalent and domains where they are less so. I am unsurprized that FF's code base has few of them. Other domains may find they are more prevalent and might include:
When a user needs to write a message with a negative literal value, they shouldn't be surprised to find that it is a syntax error.
|
I'm going to close this for now, while I prepare a document about a more holistic sigil design. |
This is a follow-up to #364, which made it possible to use unquoted literals in the argument position in placeholders. However, due to the current syntax of +open and -close function calls, arguments that are number literals must still be quoted, e.g.
{|-1| :number}
.This PR proposes to change the syntax of markup-like function calls:
The benefit of using a two-char-long prefix is that we effectively establish the colon
:
as the general-purpose function introducer.