Okay, what happened to my literal strings?

Burton Radons burton-radons at shaw.ca
Thu Sep 6 15:43:25 PDT 2007


Ah, so 'const char [] foo = "bar";' works, does it? No thank you. Const 
forcing (whatever the name given) is the kind of tiddlywinks 
obsessive-compulsive bullshit that can't even be enforced so it's useless to 
everybody* which caused me to flee from C++. I've been using D as my primary 
language for... five years and four months now, and this lack has not 
resulted in a bug once. Needless to say, C++'s const didn't save me from a 
single bug either, but instead wasted my time (just like a bug does - the 
irony of many mollycoddling features is that they cause you to spend more 
time dealing with them than you would to deal with the bugs, if they even 
existed) by having me pour over code inserting const or casts everywhere 
like the virus it is.

This is _significantly_ against what I want from a language, and while I'm 
not sure how I'll feel in a day or two, my current inclination is to move on 
to another language or write my own. The many megabytes of code to retrofit 
don't help either.

* Some might be deluded into thinking it's useful to them for optimisation, 
bug prevention, or interface contracts. But the only thing circumventable 
const forcing does with any faculty is provide self-documentation, and even 
there the signal-to-noise ratio is pretty awful, it's easily abused (methods 
are frequently declared const in C++ when it's not a true requirement of 
what the method does, and it prevents situations where the method really is 
const but also modifies the object's data, which is not a paradox - the data 
might be cached or synthesized), often fraudulent, and usually not 
enforceable by the method. This is well-discussed and it seemed to be how 
Walter felt originally, so if someone can point out anything specific which 
changed his mind I'd be interested in seeing it. 




More information about the Digitalmars-d mailing list