const(Object)ref is here!
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Dec 7 08:09:50 PST 2010
On 12/6/10 9:56 AM, Michel Fortin wrote:
> On 2010-12-06 00:16:27 -0500, Graham St Jack
> <Graham.StJack at internode.on.net> said:
>
>> First, I have to say that it is wonderful that someone is taking a
>> serious look at this area again, and even better, you have come up
>> with a compiler patch to make it happen!
>>
>> Some questions (assuming your patch or something like it gets into dmd):
>>
>> Does this mean that I would be able to write this:
>> immutable(Foo)ref foo; // create a reference
>> foo = new immutable(Foo)(); // re-bind it (not sure about "new" syntax
>> for immutables)
>
> That's the whole point yes. This syntax works with my patch. :-)
>
>
>> Are there any other show-stopping syntax issues that are holding up
>> widespread adoption/rollout of const-correctness?
>
> Surly there are others issues to solve. But this one is the one I kept
> falling into when trying to use immutable objects in my code some time ago.
>
>
>> What do Walter and Andrei think?
>
> That I'd like to know.
I think actually offering a patch is a great initiative! I think the
syntax is not all that intuitive, but it's great to experiment with.
Michel, I suggest you put together some documentation (instead of
implicitly referring to an earlier newsgroup discussion) so the
community knows what to expect from the patch. Also providing
precompiled binaries would help people who don't care to build their own
compiler.
Andrei
More information about the Digitalmars-d
mailing list