Proposal - Revised Syntax for const and final

Janice Caron caron800 at googlemail.com
Sat Sep 8 08:38:51 PDT 2007


OK, I guess you're right about PODs. Let's try again, but more generally:

Regardless of the type of T:

final(T) would be a type that was similar to T except that it would be
const, its members would be mutable, and all of its members' members
would be mutable, etc..

const(T) would be a type that was similar to T except that it would be
const, its members would be const, and all of its members' members
would be const, etc..

const*(T) would be a type that was similar to T except that it would
be mutable, its members would be const, and all of its members'
members would be const, etc..

const**(T)  would be a type that was similar to T except that it would
be mutable, and its members would be mutable, but its members' members
would be const, etc..

Now, if some of those possibilities turn out to be nonsense (e.g
final(int), then we can always make those possibilities compile-time
errors.

But it would be consistent, logical, and a boon to generic programming.
No?



More information about the Digitalmars-d mailing list