`shared`...
ag0aep6g
anonymous at example.com
Mon Oct 1 09:55:41 UTC 2018
On 10/01/2018 08:47 AM, Nicholas Wilson wrote:
> In order to be safe, a mutable parameter can be implicitly cast to
> shared iff the parameter is also scope (that includes the `this`
> reference`). With an implicit cast in place of the explicit cast under
> the new rules it would fail to compile because the `this` reference is
> not scope.
I don't see why it would fail to compile. There's no reason why my
`doThing` couldn't be marked as `scope`. It doesn't leak anything.
`pure` would break the example. I'm not sure if it would ensure safety,
though. Can a `pure` method spawn a new thread (that outlives the method
call)?
More information about the Digitalmars-d
mailing list