Immutable and unique in C#

Jonathan M Davis jmdavisProg at gmx.com
Sun Nov 11 19:06:11 PST 2012


On Sunday, November 11, 2012 17:29:02 Walter Bright wrote:
> I'm not convinced that adding a "unique" qualifier is strictly necessary.

Where it would be particularly valuable would be passing stuff across threads 
with std.concurrency. We don't _need_ it for that however. It would just make 
it cleaner, because you wouldn't have to worry about whether anything else on 
the current thread had a reference to what you were passing across.

So, while I think that it would be nice, I'm not convinced that it's worth 
adding at this point. There's a halfway decent chance that you'd just end up 
casting to unique to pass it across anyway (depending on how the value was 
constructed), which then puts us in exactly the same boat that we're in now 
except for the fact that we're casting to unique instead of casting to shared 
or immutable.

- Jonathan M Davis


More information about the Digitalmars-d mailing list