Suggestion: object const'ness

Tom ihate at spam.com
Fri May 19 16:44:07 PDT 2006


One of the flaws of the language IMHO. Also in/out/inout is flawed and 
seems merely informative instead of being strict in allowing/disallowing 
parameter modification. I'm on the side of const-like solution and 
*TRUE* in/out/inout param attributes. When I first read about D and all 
these promising features I was really amazed till I try some of them 
(like in/out/etc). I felt disappointed though I still love the language 
and it's a shame this little stuff doesn't work as one expect.

Some of the allegations against const was that it could easily be 
circumvented. I wonder which feature couldn't be circumvented if inline 
asm is permitted. Anyway, I hope all this to be fixed before 1.0.

--
Tom;

ChristopheBourez escribió:
> It should be interesting to have a const'ness ala C++, I mean, the ability to
> declare methods that do not modify the state of objects.
> 
> class X 
> { 
> public:
> void ModifyState?();
> void DontModifyState?() const;
> };
> 
> Any comments?
> 
> Christophe
> 
> 



More information about the Digitalmars-d mailing list