On Tue, 07 Dec 2010 09:05:20 -0500, Jason House <[email protected]> wrote:

Michel Fortin Wrote:
The point is that the 'ref' in in the 'b' and 'c' variable declaration
has the effect of changing the ref from B and C from const to mutable,
even for B where the ref was explicitly specified to be const. I was
wondering if some people would find that surprising, but if I
understand you well that's what you expect when seeing this, right?

I've been wondering if it makes more sense for 'ref' to be a storage class rather than some kind of type constructor. Doing that would make the typedef's with ref be illegal. It'd also make foo!(const(T) ref) be illegal as well as (const(T) ref)[]. As a storage class, it can only be added to variable declarations.

IIUC, I think ref in this case is a type modifier. There are other examples of keywords that are both storage classes and type modifiers (const, shared).

-Steve

Reply via email to