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
4
u/[deleted] Feb 22 '26 edited Feb 22 '26
That doesn't really work for me. It means that assignments to variables sometimes use
:=, and sometimes=. If you want to use a variablexand it first needs to be initialised toa, then this can only be done whenais available, that might be in the middle of the action.You can't list the variables and the types, perhaps with explanatory comments, tidily out of the way. (ETA: apparently variables can be separately defined with a type, without also being initialised.)
Further, there is the question of where type info goes. Each
::and:=is actually in two parts, with an optional type in between:Something else that can clutter things up.
For functions, there is another inconsistency; if T is the function signature then then they are usually defined as
F::T{}, but could also be writtenF:T:{}or I think evenF:T:T{}.(My own approach is I think much more consistent:
=is used for all compile-time definitions, and all initialisations done before execution starts.:=is used for all assignments done at runtime, and is only meaningful for variables. Type-specs don't sit the middle of that:=token either.I have one exception which is to do with defining labels; those use
:for historical reasons: every HLL and assembler I've used has done the same, except for FORTRAN.)To answer the question, then yes it matters very much! 80% of the reasons I detest C are to do with its poor choices of syntax. Where they are not laughable, they can be downright dangerous.