[syntax] Order of variable/function in placeholder #232
Replies: 6 comments 2 replies
-
A few comments about the future example uses: a) The no-variable form is already supported by the syntax in #230, exactly as you have it there. I'm explicitly not arguing here for one choice over another, as I think either could work and support an LL(1) parser. |
Beta Was this translation helpful? Give feedback.
-
The mindset that helped me come round on this was to think of formatters as methods invoked on the argument. I remember we even discussed something like This way, it puts more emphasis on the argument, which is nice semantically, but also important practically: many CAT tools will abbreviate the entire placeholder like |
Beta Was this translation helpful? Give feedback.
-
That's what I tried to capture as a narrative that I see for (1). My concern is that it corners functions to be formatters - after all if there's no variable, the formatter makes no sense. Which I think is a limiting mental model. I can see cases (and Eemeli pointed out that they're now supported) when a function is not a formatter. I agree that if a) standalone is supported, b) multivariable can work either via That, in result, is subjective, and I will not oppose if the group decides that (1) is a better option, but I would like to see it explicitly decided, rather than implicitly adopted. |
Beta Was this translation helpful? Give feedback.
-
It corners formatters to be functions, but it doesn't say that there can't be other functions. I think of selectors as functions also, but they are not formatters. For example, plurals evaluate a parameter ( |
Beta Was this translation helpful? Give feedback.
-
At least for me the reasoning is that when I compose a message the important part is WHAT is formatted, not its type. When you read the message, you think Also, if we look at what is a more common use, Otherwise, both options seem identical in power / expressivity. |
Beta Was this translation helpful? Give feedback.
-
Thank you all! I see the consensus emerging toward (1), with resolution of my concerns as:
There does not have to be.
There does not.
It is possible to assign local variables as functions and then use them as arguments to another formatter. We even prefer that over traditional composition. == Thank you all. I consider this topic resolved unless new arguments show up. We can then reopen. |
Beta Was this translation helpful? Give feedback.
-
At the time when we were discussing different models of capturing placeholder formatter calls, there were two main "approaches":
{ $count :number key=value }
{ :number $count key=value }
Recent discussion and feedback from ICU TC follows the (1) path. I'm not sure how much of that is the bandwagon from MF1, vs conscious preference.
I'd like to make an argument for us to consider (2) as a superior syntactical choice.
If I understand correctly the syntactical narrative of (1) is that there is a variable (axiom) that can be optionally formatted by formatter
:number
with some optional arguments.There are multiple limitations of that model:
a) There has to be a variable for any function to be called
b) There has to be exactly one variable
c) There is no clear way to compose calls
I'd like to argue that separately from whether we should implement those features, having a syntax that can, in the future, extend to them, is superior.
Particularly, I see the following potential future examples of uses:
a)
Launch { :app_name variant="accusative" }
// No variableb)
Showing appointments for { :date_range $start $end style="long" }
// can be worked around with[$start, $end]
syntaxc)
You have { :number(:round($number)) }
// I don't know how to express it cleanly in S-exprFinally, I struggle to identify the advantages of (1) - either for today, or in form of future scaling options.
Beta Was this translation helpful? Give feedback.
All reactions