amazon-ion / ion-docs

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

Significance of whitespace in expression group syntax is potentially confusing #344

Closed popematt closed 1 month ago

popematt commented 1 month ago

Multiple early users and implementers have complained about the expression group syntax. The distinction between (:foo) and (: foo) is easy to miss. Also, there is asymmetry between this and the TDL equivalents—(foo) and (; foo) respectively.

popematt commented 1 month ago

Something like this can solve both of those complaints.

Macro Expression Group
E-Expr (:foo) (:: foo)
TDL (;foo) (;; foo)

Although the use of ; for macros is unexpected, and ;; looks rather jarring. Using a different operator symbol character as the sigil in TDL could be easier to read. E.g.:

Macro Expression Group
E-Expr (:foo) (:: foo)
TDL (.foo) (.. foo)

Though not as lisp-y, the . operator has some precedence in popular programming languages for invoking methods, so this usage will not be completely foreign to people learning TDL.

As a side-effect of this change, we would no longer need to escape s-expressions in TDL (see #343). If we need a s-expression that starts with . we only need to wrap the . in a literal clause.

popematt commented 1 month ago

Resolved in #351