const/immutable member functions

Andrej Mitrovic andrej.mitrovich at gmail.com
Mon Jan 24 06:45:27 PST 2011


Perhaps it would be less ambiguous if we turned const/immutable for
functions into annotations:

@const Foo bar(); //const function
@immutable Foo bar(); //immutable function
@immutable const(Foo) bar(); //immutable function with const return value
@const const(Foo) bar(); //const function with const return value
immutable(Foo) bar(); //mutable function with immutable return value
@immutable immutable(Foo) bor(); //immutable function with immutable
return value

But I'm not a big fan of "@", it clutters up source code.


More information about the Digitalmars-d mailing list