Do we need a time-out in D evolution?
Walter Bright
newshound1 at digitalmars.com
Sat Jun 9 21:00:30 PDT 2007
eao197 wrote:
> I don't agree with you. As a C++ programmer I'm big fun of 'const' -- it
> have saved me from bugs several times. So when const became a part of D
> I certaintly rewrite my code with use of const/final/invariant. To show
> you how it can affect my project I can say -- in one my rather big C++
> library (~46K lines) there are 121 *.hpp files with ~280 const methods
> and ~900 const parameters. I think it is not too easy to write all that
> staff without const at first and then carefully rewrite and retest it
> with const.
My experience with const-correctness is you can largely ignore it unless
you are writing libraries. If you are transforming bug-free, tested code
into const-correct code, it won't need much testing. Adding const isn't
likely to break anything at runtime, just at compile time.
Also, although the design is a bit on the complex side, I don't think
that complexity will show through much in user code. With type inference
and 'in' parameters, I don't think you'll have to write 'const' all that
often - certainly much less than in C++.
More information about the Digitalmars-d
mailing list