Immutable and unique in C#
Walter Bright
newshound2 at digitalmars.com
Sun Nov 11 17:29:02 PST 2012
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.
More information about the Digitalmars-d
mailing list