Skip to content

Change open/close from function to expression #466

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
Closed

Change open/close from function to expression #466

wants to merge 1 commit into from

Conversation

mihnita
Copy link
Collaborator

@mihnita mihnita commented Sep 4, 2023

Replacing #447

Merging was too messy, and my change was in main, not in a branch.

Copy link
Collaborator

@eemeli eemeli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As proposed, this PR is a pretty direct s/function/expression/ replacement in the middle half of the Expression » Annotation » Function section of the syntax spec. Here's how it currently looks like.

This kinda doesn't make sense, with half of the function explanation suddenly talking about expression instead. If we do want to describe open/close/standalone with reference to the expression as a whole, these paragraphs should be extracted into a separate section.

I'm also not convinced that this change is beneficial as:

  1. the description of open/close with respect to function is valid,
  2. our formatting and registry is completely unaffected by the proposed changes and still considers the open/close sigils only during function lookup, and
  3. I don't see how this is "Bringing the spec description in sync with the abnf".

Copy link
Member

@aphillips aphillips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @eemeli that the title is probably wrong. The ABNF clearly makes the +- sigils part of function names and is quiet about open/close expressions. If we were to truly bring the spec into alignment with the ABNF, this would effectively say that +foo, -foo and $foo are not distinct from one another, or, if they are distinct, that the distinction has no effect on the parsing of the message.

We need to decide about what open and close mean and what, if any, restrictions go on them, how open and close "communicate" with each other or get paired, and so on. Or we need to reserve these differences to future versions or to implementations.

@@ -412,32 +412,32 @@ what _options_ and _option_ values are valid,
and what outputs might result.
See [function registry](./) for more information.

_Functions_ can be _standalone_, or can be an _opening element_ or _closing element_.
_Expressions_ can be _standalone_, or can be an _opening element_ or _closing element_.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I were to make this change, I would make "element" into expression too:

Suggested change
_Expressions_ can be _standalone_, or can be an _opening element_ or _closing element_.
An _Expression_ can be _standalone_, or can be an _opening expression_ or _closing expression_.

Comment on lines +418 to +419
An **_<dfn>opening element</dfn>_** is a _expression_ that SHOULD be paired with a _closing element_.
A **_<dfn>closing element</dfn>_** is a _expression_ that SHOULD be paired with an _opening element_.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and I would do that globally...

Comment on lines +430 to +434
> A _message_ with two markup-like _expressions_, `button` and `link`,
> which the runtime can use to construct a document tree structure for a UI framework:
>
> ```
> {{+button}Submit{-button} or {+link}cancel{-link}.}
> {{button +html}Submit{button -html} or {link +html}cancel{link -html}.}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a metacomment rather than one on this particular change.

I tend to want the examples in our spec to be valid functions in the function registry or to be clearly from the "foo" family of example markup. If we don't provide HTML functions in the default registry or an optional extended registry, I'd prefer to use examples that are suggestive but not real. The original example did that better than providing the +html markup.

I do see that you want to show functions with operands, so perhaps consider examples.

Comment on lines +440 to 442
- `:` for a _standalone_ expression
- `+` for an _opening element_
- `-` for a _closing element_
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expressions here too

Copy link
Collaborator

@stasm stasm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the current ABNF, expressions are what goes into the placeholder, including the case when there's no function. Consequently, I think this PR should instead talk about function annotations, which is our way of saying "function invocations" or "function application".

In other words, open/close are not a property of the function (an abstract entity that needs to be called to do anything), but instead are a property (in the current design) of the function's application/invocation/call, i.e. annotation.

@aphillips aphillips changed the title Bringing the spec description in sync with the abnf Change open/close from function to expression Sep 4, 2023
@aphillips aphillips closed this Sep 25, 2023
@mihnita mihnita deleted the mihai_sync_spec_to_abnf branch February 14, 2024 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants