Sharing in D
Walter Bright
walter at nospamm-digitalmars.com
Fri Aug 1 13:42:59 PDT 2008
Steven Schveighoffer Wrote:
> I'm thinking more in the case of functions. If I have a function foo, and I
> want to pass my shared data version to it, I need to re-implement foo with
> the parameters as being shared. Imagine a function with several parameters,
> in which you want to pass a combination of shared/unshared. That's 2^n
> variations you have to write.
Not necessary, just make them shared. Unshared implicitly converts to shared, so that works. Putting a fence around an unshared read doesn't break anything, etc.
> I think at the very least, for this to be palatable, there needs to be
> another modifier that unifies shared and unshared. Similar to how const
> unifies mutable and invariant.
Shared unifies shared and unshared.
More information about the Digitalmars-d
mailing list