Do we need a time-out in D evolution?

Bruno Medeiros brunodomedeiros+spam at com.gmail
Mon Jun 11 04:46:48 PDT 2007


Sean Kelly wrote:
> Walter Bright wrote:
>> 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++.
> 
> I'll admit that one of my reservations about 'const' is the need to 
> potentially write twice as many class methods.  I don't suppose there's 
> any way around this?
> 
> 
> Sean

Good question, I wonder if this has been given any thought by Walter and 
others on this, and if perhaps a solution like Javari's romaybe has been 
considered. It might be really a problem if we have to write multiple 
versions of the same version, which like Frits said, may be 3 and not 
just 2 versions.

-- 
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d mailing list