D2.0 const this methods

Georg Wrede georg at nospam.org
Mon Jun 18 18:38:31 PDT 2007


Walter Bright wrote:
> Bill Baxter wrote:
> 
>>  From the const page docs
>> class Foo {
>>    invariant int foo() {
>>       ...
>>    }
>> }
>>
>> makes 'this' and the return value invariant.
> 
> No. invariant as a storage class on a member function only makes the 
> member function invariant, it does not affect the return type.

Am I the only one who thinks it is hard to remember that a word (here 
'invariant') somewhere applies on this and otherwise on that?

Should we have the keywords applying to the function be written after 
the function signature, and those applying to the return type before it?

(I'd really hate D to become another language where one has to remember 
a truckload of stuff by heart.)



More information about the Digitalmars-d mailing list