amazon-ion / ion-docs

Source for the GitHub Pages for Ion.
https://amazon-ion.github.io/ion-docs/
Apache License 2.0
22 stars 22 forks source link

Replace grouped-parameter lists with new syntax for argument groups. #302

Closed toddjonker closed 6 months ago

toddjonker commented 6 months ago

The new syntax (: ...) denotes an "argument group" and can only occur in an E-expression. It replaces the use of lists to pass multiple expressions to a single parameter.

"Grouped parameters" are removed from signatures, leaving only cardinality. To use multiple expressions with a parameter, the caller uses an argument group. A single expression (of appropriate shape) is always acceptable, regardless of cardinality.

In the template language, macro invocations can use the syntax (; ...) to denote argument groups.

As you can see from the text changes, this is more simple than the prior syntax and semantics. It turns grouping into a syntactic concern at the macro invocation site.

Issue #, if available:

This change is related to #291 but has at least one key difference. As proposed here, argument groups are not general-purpose streams, and can only appear in macro-argument positions. This is because they have a critical difference from the values macro: their contents are shape-constrained by the relevant macro parameter's type, most obviously for macro-shaped parameters. Personally, I'm in favor of keeping argument groups and values invocations syntactically distinct, to reduce confusion.

Other notes:


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

toddjonker commented 6 months ago

I believe we have consensus, modulo the concrete syntax. Holding off on merging to let people review my updates yesterday.

toddjonker commented 6 months ago

Ooops @popematt our messages passed in spacetime. Did you get a chance to see the latest updates?

popematt commented 6 months ago

@toddjonker Yes, I did see the updates.