Ulrik Mikaelsson wrote:
The purpose of higher-level languages is to encourage "good" programming style and readability. Period. The syntax is crucial here, it determines which constructs will become readable, and which won't, which in turn determines the mind-set of the programmer. Which is why I consider syntactic sugar to be seriously under-appreciated and undervalued in many language decisions.
That's one way to put it. I view a programming language as a way to map the way humans think into the way the machine works. Orthogonal languages have a mathematical simplicity to them, but (as one quickly discovers when trying to implement a good user interface) people are just not orthogonal and do not think in an orthogonal matter. Good user interfaces tend to be enormously complex under the hood, all to create a "simple, intuitive" interface?
For example, why have do-while loops, while loops, for loops and foreach loops? Only one is really needed in an orthogonal language. The multiple forms persist in language after language because they fit the idiosyncracies of how our brains think about coding.
As many of you know, I like to work on my cars. My emergency toolkit has just a small handful of simple tools, like a screwdriver. I can use a screwdriver as a screw driver, a hammer, a lever, a chisel, a punch, a scraper, a mixer, even a bus bar (to short across the starter relay). It's good enough at those things to get me home.
But when I'm home, I reach for a tool designed specifically for the purpose. That means I've got a lot of tools. Yup.
I kind of view the "complexity" of D that way. There are a lot of tools in it for specific jobs. Yes, I could get the job done with a screwdriver and monkey wrench, but it would be ugly. I can do lambdas and closures and virtual functions in vanilla C, too, it's just darned messy, unappealing, time consuming and far more likely to skin my knuckles.
