Stepping back and looking at constness from another angle.

Thomas Kuehne thomas-dloop at kuehne.cn
Wed Jun 6 12:50:47 PDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Craig Black schrieb am 2007-06-05:
> Guess I should put in my 2 cents also, since there are so many people who 
> seem to dislike the idea of const in D.  I am a C++ programmer that uses 
> const a lot.  I am the primary author of a very big API that is used by 
> other developers.
>
> There are cases where things get complicated, but for the most part, const 
> really helps.  It helps that the compiler enforces the rules.  So I like the 
> idea of adding const to D in some form.  I admit I don't understand all the 
> details of D's const implementation, but I don't think that adding const in 
> D is a bad thing.

I don't work with much C++ code, however when I do it is mostly
maintenance work of poorly documented code and "const" really helps.
Without "const" I'd have to read much more code to understand what
is going on, with "const" functions and "const" arguments the job is
vastly easier. Yes, C++'s "const" can be subverted in several ways
but is a fairly good indication of the intended behaviour.

Thomas

-----BEGIN PGP SIGNATURE-----

iQIVAwUBRmcOK7ZlboUnBhRKAQIEVA//RIck6oBs9Y4FFfBgwAdNN8K4dX6RRfKG
nv3vuFAynOKqYi381quExJt2AfIRnZHk3jtWMrZTjkJRXcg0j31H3zkmKPwwN9Cp
rS20sKeCSStRs+UsrOaikieHBtC0sRPQHQcqVmALmbu7mDIiA/aGbrCnSStoE+6d
2zbQO+GlW/r21YTubu9QaM1UtK4wbBytDthRgVXYMYwrFvAd5cXnF1qvuoYJU01W
52iFJPAWlDQ5trJAis2F/uFt6xrG1Ht/Ms7QYSnf8FlZ/svgGA0ArbT3IdZCzOET
HFQB3e4dyd0Bstc+beVCUi0EB83GB3ABzrgc6rEiDTLvBtSeyAaPWReu3KsRasob
gxviQV+5X0IpP//LMLyN1FLOWR4ttt6/xvkxl1rLz+9BFR+tCiAypG66i5RTiWMp
RXZxtCDqAmbYrSDfDHNiM8KUwYptLMPrP/ezwX3rT5hGE/PZNtFt3se8NIhS5scd
sEQqj0CUTy3t9mkP+7yzGc+JWvsj4bWK02yiRssDp3T6JhV4XzByq+p4o2PFPd+6
5k7lUUOo0j3Id/bGTxTt5Bk3oTifXtX9YW1nmCmWRVrePOgBdJLrWbaqykeFgNsc
+PESLCA4+xLIWvL1NQJFP3fJ63TwbIHbC0j4TZnZJk5g1nrEoxQMbkoFxEwSwKcG
1/uaLXyNwbA=
=xc/Y
-----END PGP SIGNATURE-----



More information about the Digitalmars-d mailing list