-
Originally opened by @extemporalgenome in cuelang/cue#697 In CUE, we have a (all of these [proposed] builtins are unary/1-ary, taking a single argument). It's plausible that one or more of the following will occur over time:
In such cases, we could imagine that function applications will be nested, such as:
In such cases, we have the opportunity to make this read more nicely if we allow the application of unary/1-ary functions to omit parentheses and syntactically be right-associative and have precedence higher than '&' and '|', but lower than that of other operators, so the following would be equivalent to the above:
Use of the
Arguably some unary functions should stylistically still be parenthesized even if this idea has merit, such as CUE feels like a language that could take a few different directions in terms of new features added and the syntactic tradeoffs that result from that. If CUE goes in the direction of more builtins (particularly unary/filtering builtins), omitted parentheses would give the language more of a fluent DSL style. Conversely, if CUE favors new operators or syntactical forms to manage indirect constraints, builtins will play a lesser role and this idea would have little benefit. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Original reply by @verdverm in cuelang/cue#697 (comment) RE: user defined functions / builtins discussion in #350 Query Proposal is relevant here too #165 There are more I am likely missing that would be of interest. Cue's syntax is solidifying. The intention is to make the same guarantee about v1 as Go did, and while 1.0 is probably a ways off, @mpvl wants to get backwards incompatibilities all taken care of in 0.3.0 |
Beta Was this translation helpful? Give feedback.
-
Original reply by @mpvl in cuelang/cue#697 (comment)
I'm thinking it may possibly result in too many ambiguities and complications, but I see your point. There are a bunch of other builtins being designed in unison with |
Beta Was this translation helpful? Give feedback.
Original reply by @mpvl in cuelang/cue#697 (comment)
not
is defined differently, so in this case one should writemust(binaryFunc(field, somethingElse) >= 5)
but I see your point.I'm thinking it may possibly result in too many ambiguities and complications, but I see your point.
There are a bunch of other builtins being designed in unison with
must
andnot
to clear up the meaning of (and get rid of) comparisons to_|_
(officially unsupported), make "switching" nicer, and probably to deprecate_|_
altogether in the process. It may be best to suggest it there, if it still makes sense.