Immutable and unique in C#

deadalnix deadalnix at gmail.com
Mon Nov 12 05:09:36 PST 2012


Le 12/11/2012 02:29, Walter Bright a écrit :
> On 11/11/2012 10:59 AM, Sönke Ludwig wrote:
>> However, I have to admit that without actually trying it and seeing how
>> usable it is first hand, it's difficult to tell how usable it is in
>> practice (e.g. because D functions have to be explicitly tagged 'pure'
>> for the recovery to work).
>
> With purity, transitive immutability, and transitive sharing, D already
> is quite a long way down the road. But we can go further, as currently
> new() and pure functions are not exploited for their implicit casting
> ability.
>
> For example,
>
> struct S { int x; }
> ...
> shared S* s = new S();
>
> can be made to work, as can:
>
> pure S* foo(S* s);
> shared S* s = foo(new S());
>
> I'm not convinced that adding a "unique" qualifier is strictly necessary.
>

Due to how delegate currently work, it isn't safe AT ALL. I've made a 
thread about that already.


More information about the Digitalmars-d mailing list