-
-
Notifications
You must be signed in to change notification settings - Fork 36
Change the syntax of the #open and /close function calls #398
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.
eeae91d
to
a8894f9
Compare
If There's also prior work of using
|
I would consider
Looking at these examples, the sense I get is that there's well-established precedent in templating languages for something like This seems like a completely different meaning than our intended use for "open" and "close" indicators? |
You're right, we made an effort to avoid certain characters, and |
Hmm, can you elaborate why you think it's different? In both of the use-cases you described (repetition and open/close) there's need for something that denotes the beginning of a block and the end. I see |
With the existing meanings of So while the syntax is roughly similar, the existing usage of this particular start/end pair carries a clear pre-existing semantic meaning for the tags. Our usage is more like the |
I pushed a commit to this PR which changes the placeholder-open syntax from |
There are different semantics: condition, repetition, nesting, overlapping, etc. All of them can be expressed in writing with some sort of a "block" syntax. I don't see |
We spent a long time previously discussing open/close semantics, including the ability to have only open or only close placeholders (unpaired) in a message. Where we arrived is that If we don't define rules for pairing (perhaps in the registry), we aren't really changing this. Each placeholder only controls the content of its expression (that is, the space between the If we want block-like syntax or required-to-be-paired placeholders, maybe they should have separate identifiers. I think I'd prefer not to invent a large variety of sigils for different uses ( Maybe a question would be: Should we provide function signatures that are required to be paired (as a convenience to function authors)? I understand that there can be messages that contain only an open or close tag for a markup language, but what if the output you're trying to make is an attributed string rather than markup? Should there be a way to make some (not all) unpaired functions an error? Perhaps instead of a zoo of sigils, would it make sense to establish naming conventions for pairing (perhaps with corresponding description in the registry)? What about:
|
I don't think we want to express the notion of required-to-be-paired placeholders in the syntax. Instead, I was under the impression that we wanted three kinds of placeholder "markers" (standalone, open, close) without defining the semantics of what "open" or "close" mean. Each custom function which chooses to have an open/close variant can choose what it means for the message content. I'd like to approach the whole problem space holistically: write down what sort of different placeholder types we want and what requirements for identifier names and unquoted literals we have, and then design the syntax from that. Right now we have a few related discussions in flight: #399, #403, #404, and they could benefit from an up-leveling of the conversation. I'm also happy to discuss a single sigil + a set of naming conventions based on the same requirements as above. |
@stasm Can you point to any prior usage of
|
I'm not trying to argue that there is a prior usage of
Thanks for this example, I think I understand your point of view better now. If this was indeed our syntax today, then I think I'd agree with you in that I'd expect |
#399 (comment) (emphasis added):
|
I'm going to close this for now, while I prepare a document about a more holistic sigil design. |
This is an alternative to #397, which I'd like to collect feedback on. 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.July 2 Update
I've morphed this PR to propose
{#open}...{/close}
. See #398 (comment).