You are a stupid programmer, you can't have that

Walter Bright newshound2 at digitalmars.com
Sun Aug 8 08:59:16 UTC 2021


On 8/7/2021 6:05 AM, Dukc wrote:
> `version` declarations. They do not allow expressions in them, but if one really 
> needs expressions, `static if` will work around the problem.

Many years back, some revisions were made in druntime to use enums and `static 
if` instead of versions. It didn't take long before the problems I warned about 
with #if expressions emerged.

It's inevitable.

I replaced it all with versions, and the problems went away.

D's design is very much based on decades of my experience with unanticipated 
problems that arise from certain features, and my discussions with other 
experienced programmers and team leaders about what goes wrong and causes trouble.

---

As for car analogies, I recall a TV show called "Pinks" where amateur drivers 
drag raced for pink slips. On one episode, a teenager showed up with his Beetle, 
in which he had installed a much more powerful engine.

The christmas tree turned green, he popped the clutch, and snapped both rear 
axles. The car rolled 10 feet down the track and stopped. He sheepishly got out, 
suffering a humiliating defeat.

He shows up again on another episode a few months later. This time, he says, he 
got the drive train upgraded for the power. But also, his Beetle had sprouted a 
full roll cage. The MC asked him about the cage, and he sheepishly rolled his 
eyes and said his mom made him put it in.

The tree turns green, he popped the clutch, and launched down the track. About 
halfway down, a front axle gave way. As the car was going very fast, it promptly 
flipped and tumbled down the track, over and over, with pieces of the car flying 
off everywhere. The MC was all "oh my gawd" and everyone ran down the track to 
see if he was dead. There was nothing left of the car but the roll cage, with 
our hero strapped within. He was unhurt.

All he said was "thank god for mom!"


More information about the Digitalmars-d mailing list