2 ms·
Information that might be of interest to someone here: The formal name for the “empty” binary infix operator that gets implied in the AST when doing this, is t
by derefr 7mo ago
Information that might be of interest to someone here:
The formal name for the “empty” binary infix operator that gets implied in the AST when doing this, is the “juxtaposition” (or “juxtapose”, or “juxt”) operator. The implicit multiplication operator between `3` and `a` in the polynomial expression `3a + 4`, and the implicit function-application operator in the Lambda-calculus expression `f x y`, are both instances of an implied juxtaposition operator (with different semantics for it in each of the two cases, as befits each type of algebra/calculus.)
- owlstuffing 7mo agoYes, 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.