Skip to content

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

Closed
wants to merge 1 commit into from

Conversation

stasm
Copy link
Collaborator

@stasm stasm commented Jun 19, 2023

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:

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.

stasm added a commit to stasm/message-format-wg that referenced this pull request Jun 19, 2023
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.
@stasm stasm force-pushed the open-close-colons branch from ac34de1 to ae99328 Compare June 19, 2023 09:02
stasm added a commit to stasm/message-format-wg that referenced this pull request Jun 19, 2023
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.
@aphillips aphillips added the Agenda+ Requested for upcoming teleconference label Jun 19, 2023
@eemeli
Copy link
Collaborator

eemeli commented Jun 19, 2023

due to the current syntax of +open and -close function calls, arguments that are number literals must still be quoted, e.g. {|-1| :number}.

To qualify this a bit, only literals that represent negative numbers must be quoted with our current syntax; for example

{1 :number}

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.

@aphillips
Copy link
Member

@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:

  • finance (gain/loss, performance)
  • weather (low temperatures, changes)
  • sports (over/under)

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.

match {$temperature :lt}
when -20 {Is it cold?}
when -10 {Significant risk of chapped lips}
when 0 {Freezing}
when 10 {Bring a coat}
when 20 {Not bad}
when * {Is it hot in here?}

@eemeli eemeli mentioned this pull request Jun 19, 2023
@stasm
Copy link
Collaborator Author

stasm commented Jul 12, 2023

I'm going to close this for now, while I prepare a document about a more holistic sigil design.

@stasm stasm closed this Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Agenda+ Requested for upcoming teleconference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants