ion-docs icon indicating copy to clipboard operation
ion-docs copied to clipboard

Ion 1.1 spec needs to be updated to reflect changes in macro signatures and grouped parameters

Open popematt opened this issue 2 years ago • 3 comments
trafficstars

  • In a macro signature, macro parameters are contained in a s-expression rather than a list
  • ~~Cardinality of parameters is no longer supported~~
  • Parameter types are no longer grouped in a s-expression (e.g.: (foo int))—the type is annotated on the parameter name (e.g. int::foo)
  • (:), (:void), and (:values) macros are superseded by the stream syntax [: ... ]
  • A grouped parameter is indicated by putting [] around the variable name (e.g. [foo]). When the variable has a type annotation, the type annotation stays with the variable name (e.g. [int::foo]).
  • The binary encoding uses presence bits for encoding macro arguments
  • Presence bits are required in the binary encoding if and only if there are 3 or more parameters
  • For a non-grouped parameter, a 1 indicates the parameter is present, and 0 indicates argument is not present.
  • For a grouped parameter, 1 indicates a present expression group, and 0 indicates no expression group for that parameter.
  • The text encoding no longer requires delimiting containers around the arguments for a grouped parameter. Instead, the arguments should be enclosed in the stream syntax.

popematt avatar Nov 20 '23 23:11 popematt

I'm wary of several of these proposals. It's going to be hard to discuss with all of this under one issue.

toddjonker avatar Nov 21 '23 00:11 toddjonker

  • We agreed to delay implementation of parameter cardinality, not eliminate it. (As I work on the denotational semantic model, I'm becoming more convinced that we need more strong typing, not less.)
  • Removing the S-expression from parameter type declarations eliminates a critical extension point. As an annotation, there's no good way to do anything but a type-name.
  • I'm not immediately in favor of the stream syntax and would like to understand its rationale.
  • Even given that, we still need void/values as system-defined macros for use in the template language.
  • We should still have both void and values. I want to allow the former to accept and ignore any* and thus act as an easy, structure-aware mechanism to discard a chuck of data. I find myself needing this almost daily when working with Ion-based DSLs.

toddjonker avatar Nov 21 '23 00:11 toddjonker

We agreed to delay implementation of parameter cardinality, not eliminate it. (As I work on the denotational semantic model, I'm becoming more convinced that we need more strong typing, not less.)

That's my mistake.

I've created the following issues to handle these discussions independently from each other.

  • #289
  • #290
  • #291

popematt avatar Nov 21 '23 02:11 popematt