number: -42 if opposite_day
however, almost anyone, even non-programmers can understand this: if (opposite_day) {
number = -42;
} number = -42 if opposite_day
Or this, if you prefer your conditions first: if opposite_day then number = -42What I care about from a languages syntax is that it makes programs clear to someone familiar with the language.
Like i mention previously C family programmers often cannot make head or tail of a Lisp or ML family program, yet both those languages have excellent syntax where the choices made allow the programmer to express their intentions very clearly.
Contrast this with the popular view of Perl; One persons perl code can be impenetrable to another experienced perl programmer.
Syntax matters, but the familiarity with that syntax for outsides only matters from a purely political perspective. If you want to make a successful language, make it C flavored and baroque. If you want to make a truly great language, make the syntax that is best suited to what you are doing.
Isn't that the Python fallacy? (Take away the curly braces, anyhow.)
Programming is a lot more than syntax. How many non-programmers do you know who understand the semantics of mutable assignment without having it explained?
obj: {prop: val}
obj.prop: val
obj = {prop = val}
obj.prop = val
But the main reason is to avoid the equals sign as a symbol for assignment, because it has such a different meaning that you would expect in its use in math (unless immutable), where it implies the equivalence of the expressions on the left and right side for the entire duration of your proof.Using colons, like JSON does to great effect, looks more like tagging a value with a label, which is much closer to the meaning of what you're actually doing in JS.