On 2010-12-07 02:32:11 -0500, spir <[email protected]> said:

On Mon, 6 Dec 2010 15:01:25 -0500
Michel Fortin <[email protected]> wrote:

And that's what my patch does. It only gets confusing when you add modifi
ers:

        alias const(Object)ref A;
        alias const(Object ref) B;
        alias const(Object) C;

        A ref a;
        B ref b;
        C ref c;

With my patch, variables 'a', 'b', and 'c' are all of the same type:
"const(Object)ref", the later 'ref' changing the constness of the
reference specified in the 'B' alias.

Well, as your patch introduces the possibility to "const-en" the target of
ref's, it _should_ have some meaning. Else, it leaves the language unconsis
tent, no? B & C are clearly synonym (constant references to objects), but A
 should not (references to constant objects). I see nothing wrong in having
 a type defined as one for <references to constant objects>, and in having
this different from <constant references to objects>. Do I miss some poin

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?


--
Michel Fortin
[email protected]
http://michelf.com/

Reply via email to