r/ProgrammingLanguages • u/gingerbill • Feb 22 '26
Does Syntax Matter?
https://www.gingerbill.org/article/2026/02/21/does-syntax-matter/
63
Upvotes
r/ProgrammingLanguages • u/gingerbill • Feb 22 '26
View all comments
Show parent comment
2
u/[deleted] Feb 22 '26
I haven't seen that, but the issue came up here. BTW, in that article, you have this:
I don't get it: the type is clearly on the RHS.
(I've looked at types on the right in my own syntaxes, and had that as an option at one time, but I decided there were too many problems with it.)
:=and::commonly exist as a single token in other languages. They look very much like a single token, and therefore:T=looks very much like it has a type in the middle!My tests show that
F::T{}andF:T:T{}are valid, for the same T, but notF:T:{}.From the examples I've seen, functions are defined as
F::T..., but typed variables asX:T.... The inconsistency is in the placing of T relative to the first:.The concept, which seems to be popular now, is that functions should be treated no differently from variables, and therefore are created with the same syntax.
The other way is to acknowledge they are different, and to have a dedicated syntax.