Extended Type Design.
Andrei Alexandrescu (See Website For Email)
SeeWebsiteForEmail at erdani.org
Fri Mar 16 15:31:07 PDT 2007
Benji Smith wrote:
> 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?
This should be a compiler error.
Andrei
More information about the Digitalmars-d
mailing list