2 ms·
Yes, the empty infix operator is often called the "juxt" operator, which is an apt term here. However, I use the term "binding expressions" intentionally becau
by owlstuffing 7mo ago
Yes, the empty infix operator is often called the "juxt" operator, which is an apt term here.
However, I use the term "binding expressions" intentionally because there’s more going on than ordinary juxtaposition. In a normal juxt expression such as:
a b c
the evaluation order is static and independent of the type system:
(a b) c
With binding expressions the precedence is type-directed, so the type system determines which grouping is valid:
(a b) c
a (b c)
Additionally, the operation itself can be provided by either operand. For a given expression a b, the compiler may resolve it as:
a.prefixBind(b)
b.postfixBind(a)
For example:
10kg
Here kg is a MassUnit, and MassUnit defines postfixBind(Number) returning Mass, so given there is no left-to-right binding, the expression resolves right-to-left as:
kg.postfixBind(10)
So while juxtaposition is the syntactic surface, the semantics are type-directed binding.