|
|
|
|
|
by jiggawatts
1855 days ago
|
|
There's empirical evidence, loads of it, that this simply isn't true. Syntax absolutely does matter, in all walks of life, not just programming. We're not infinite, error-free computers like some sort of mathematical abstraction. We have squishy meat brains evolved to tell stories around a campfire. As a random example: I learned Rust just for fun, and something that repeatedly caused hours of frustration is that unlike every other modern language, it allows identifier shadowing. This compiles and runs just fine: let a = 5;
let a = "wat?"
Practically no other language allows this, because it is a recipe for errors.Internally, compilers typically use single static assignment, so the above would be processed something like this: let a_1 = 5;
let a_2 = "wat"
For a compiler to track this is no problem. For a human? It's a problem. Maybe not for trivial examples like this, but if dozens of identifiers are littered across a huge function it can be a challenge to keep track of which one is which if the names are the same but they're... not the same. Especially if the change is subtle.We're not computers, that's why we make them out of silicon and metal and sell them for money. |
|
Source?
> unlike every other modern language, it allows identifier shadowing
1. All dynamically typed languages allow this, all/most REPLs even for statically typed languages allow this, even if regular code doesn't.
2. This is not syntax, at all, this is semantics of immutable value declaration+initialization.
> but if dozens of identifiers are littered across a huge function it can be a challenge to keep track of which one is which
Littering dozens of identifiers across huge functions is going to be a problem, no matter the syntax. It's a programmer's job to manage complexity by utilizing various kinds of techniques, including syntactic sugar (true), but also factoring the code into manageable chunks, using higher-level or better suited for the task at hand abstractions, and so on. Syntax on its own is, in my experience, the least impactful technique for managing complexity, at least before going into DSL-land (but then it's syntax+semantics).
Another thing worth mentioning is that lots of general-purpose languages give you exactly the same constructs, just spelled differently. Simple examples:
All the above denote exactly the same construct, with very little variation in the number of tokens. Can you tell me if you think one of them is better than the others - and if so, why?