August 01, 2008 Re: Sharing in D | ||||
|---|---|---|---|---|
| ||||
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.
Two, the guarantees for shared data are lost. Code using the non-shared reference will not respect that the variable really is shared.
| ||||
August 01, 2008 Re: Sharing in D | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jason House | 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. | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply