const/immutable member functions
Jonathan M Davis
jmdavisProg at gmx.com
Mon Jan 24 06:48:15 PST 2011
On Monday 24 January 2011 06:45:27 Andrej Mitrovic wrote:
> 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.
Well, any change to the situation would break TDPL, I believe, so we're pretty
much stuck. If Walter didn't think it was bad enough to fix by now, he won't fix
it post-TDPL.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list