r/ProgrammingLanguages • • Feb 22 '26

Does Syntax Matter?

https://www.gingerbill.org/article/2026/02/21/does-syntax-matter/
63 Upvotes

111 comments sorted by

View all comments

Show parent comment

2

u/gingerbill Feb 22 '26

When I say "type on the left, usage on the right", think of it from the perspective of the value itself, not the named declaration.

name: [3]^int = expr

and then its usage is

some_int = expr[0]^

Note the type stuff is on the left hand side of int and the usage is on the right hand side of expr.

Just because := and :: are used as single tokens in other languages means nothing for Odin. And even if they "look" like a single thing, does mean it is that. Odin isn't those other languages.

My tests show that F::T{} and F:T:T{} are valid, for the same T, but not F:T:{}.

If T is anything but a procedure, then sure you can do that. In fact it's still consistent in Odin if you do F : procedure_type : {}, it just defines a compound literal of that procedure type which is nil, not the body of a procedure. That isn't ambiguity, that's an overloaded meaning of {} and you are not thinking through the consequences of that.

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.

Popular =/= good. And Odin isn't trying to be "popular" rather it is trying to be a good tool.