Sharing in D
Walter Bright
newshound1 at digitalmars.com
Fri Aug 1 10:03:40 PDT 2008
Jason House wrote:
> Walter Bright Wrote:
>
>> Unshared can be implicitly cast to shared, so you shouldn't have
>> to.
>
> That should not be implicit.
>
> For one, thread-local garbage collection of non-shared data would
> leave dangling references to garbage memory.
True, but the memory allocation system shouldn't be (and isn't) built
that way.
> Two, the guarantees for shared data are lost. Code using the
> non-shared reference will not respect that the variable really is
> shared.
That would be true if shared were implicitly cast to unshared, but
that's not the case. It's unshared implicitly cast to shared.
More information about the Digitalmars-d
mailing list