Extended Type Design.
Benji Smith
dlanguage at benjismith.net
Fri Mar 16 15:15:33 PDT 2007
Andrei Alexandrescu (See Website For Email) wrote:
>> Really? I'd think super const would be used all the time. Anywhere a
>> class has some invariant field, it'll probably be expressed as super
>> const (if I'm understanding correctly that super const is the
>> equivalent of #define constants in C++ or static final constants in
>> Java).
>
> No. super const deals with pointers and transitivity. Final deals with
> non-rebindable symbols. I'd be hard pressed to think of many examples
> where class members are transitively immutable.
Aha. In that case, what would you think of the declaration:
super const int MY_CONSTANT = 6;
Since a value type doesn't have any pointers, it wouldn't make any sense
to apply super-constness to it, right? Should that be a compiler error?
--benji
More information about the Digitalmars-d
mailing list