const(Object)ref is here!

Walter Bright newshound2 at digitalmars.com
Wed Dec 8 11:17:10 PST 2010


Michel Fortin wrote:
> On 2010-12-08 03:43:45 -0500, Walter Bright <newshound2 at digitalmars.com> 
> said:
> 
>> Michel Fortin wrote:
>>> After a recent discussion on this list about tail-const class 
>>> references, it became rather clear that someone interested would have 
>>> to implement the thing if we were to have it. So I did it. See 
>>> enhancement request 5325 for an explanation and a patch.
>>> <http://d.puremagic.com/issues/show_bug.cgi?id=5325>
>>
>> I think it's great that you're trying this out. I failed at getting 
>> tail const to work. I don't think it can work, but I might be wrong.
> 
> Is there something I can do to convince you this patch works? Because it 
> does. There is still some rough edges for which I wasn't sure what was 
> the best solution -- head-modifiers not reflected in TypeInfo or with 
> is(T == const) -- but they're relatively minor and easy to fix once we 
> know what we want.

I haven't been able to look at it yet.

But the const system in dmd is rather complex, and I'm not at all comfortable 
with saying it works without quite a lot of testing. Some things to test:

1. auto variable declarations
2. typeof
3. mangleof
4. template type deduction
5. interaction with inout
6. arrays of, pointers to, functions returning
7. tail const functions
8. tail immutable
9. tail shared const
10. tail inout


More information about the Digitalmars-d mailing list