Extended Type Design.

eao197 eao197 at intervale.ru
Fri Mar 16 02:20:52 PDT 2007


On Fri, 16 Mar 2007 00:16:48 +0300, Andrei Alexandrescu (See Website For  
Email) <SeeWebsiteForEmail at erdani.org> wrote:

> a) final - a simple storage class controlling the immutability of the  
> bits allocated for the symbol per se;
>
> b) const - type qualifier meaning an immutable view of an otherwise  
> modifiable data. const does not control the bits of the object, only the  
> storage addressed indirectly by it (transitively);
>
> c) "superconst" - denoted as "const!" or "super const": type qualifier  
> meaning that the data is genuinely unmodifiable.

Great!

What about the influence of this storage classes on class method's  
signatures? Is this will be in D:

class Data { ... }

class Container {
   // non-const access to data.
   Data data() { ... }
   // const access to data.
   const Data data() const { ... }
}

void useContainer( const Container c ) {
   auto d = c.data(); // the type of d is 'const Data'.
   ...
}

?

-- 
Regards,
Yauheni Akhotnikau



More information about the Digitalmars-d mailing list