-
-
Notifications
You must be signed in to change notification settings - Fork 36
Use (parentheses) rather than "quotes" around literal values #276
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with this change, but remain uneasy about using such a common character pair. I buy @stasm's arguments about using separate open/close characters, otherwise I'd suggest using backtick (U+0060
). Or maybe use
<and
>`? Those aren't as common in "normal" text (although they are not HTML friendly)
One challenge with backticks Angle brackets Hence parentheses |
FWIW, in #263 I was trying to say that for literals we might not need separate open/close delimiters, like I'm advocating for in case of patterns. I also have a concern about angle brackets which I shared in #263 (I'm trying to separate the discussion about the design from the discussion about the implementation). |
I don't think that round brackets are not much better than It means that they become "something to escape", because they can be encountered in plain text. TLDR: same as Addison, "remain uneasy about using such a common character pair." I don't think that Java can use .xml for resources, and some prefer them to Even with HTML-like templating. I know of several localization systems for html that "embed" the localizable strings in html: |
There are two "directions" of escaping that we should be considering.
Choosing something else that the single quote, double quote, backtick or angle brackets optimizes for the "outside". You're right that there may be cases when an "inside" conflict happens. The PR actually makes one of them clear in one of the examples:
Do you think a pipe would be a better choice here? Or any other character?
|
FWIW, I think I'm OK with |
Co-authored-by: Addison Phillips <addison@lab126.com>
Rebased to account for changes in other merged PRs. @mihnita Did you have concerns about preferring |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Co-authored-by: Markus Scherer <markus.icu@gmail.com>
@eemeli needs rebase but ok to merge |
Co-authored-by: Addison Phillips <addison@lab126.com> Co-authored-by: Markus Scherer <markus.icu@gmail.com>
Closes #263 by replacing
"quotes"
with(parentheses)
as delimiters for literal values. Correspondingly, the String token is renamed as Literal, though it's still expected to always be parsed into the data model as a string value.Within a Literal, both
(
and)
require escaping. Strictly this is only required for the closing parenthesis, but not also escaping the start looks odd, and should improve the experience for anyone looking at MF2 source in an editor that uses generic parenthesis-matching highlighting.