transporting qualifier from parameter to the return value

Jason House jason.james.house at gmail.com
Wed Dec 16 05:39:47 PST 2009


Walter Bright Wrote:

> Steven Schveighoffer wrote:
> > type constructor.  it has no meaning as a storage class since it's 
> > entirely transient (it only has any meaning inside functions).
> 
> I meant does it only apply at the top level, or does it apply down 
> inside types?

It has to apply inside types unless we can prove it isn't  needed. Consider a function that accepts inout(T) and returns inout(U). The extraction of U from const(T) is const(U) just like extraction of U from immutable(T) is immutable(U) because of transitivity rules.

I don't think a proof exists. Consider class T { U u; } and other more deeply nested variations.



More information about the Digitalmars-d mailing list