shared - i need it to be useful

Nicholas Wilson iamthewilsonator at hotmail.com
Sun Oct 21 23:12:13 UTC 2018


On Sunday, 21 October 2018 at 21:32:14 UTC, Walter Bright wrote:
> On 10/21/2018 2:08 PM, Walter Bright wrote:
>> On 10/21/2018 12:20 PM, Nicholas Wilson wrote:
>>> Yes, but the problem you describe is arises from implicit 
>>> conversion in the other direction, which is not part of the 
>>> proposal.
>> 
>> It's Manu's example.
>
> Then I don't know what the proposal is. Pieces of it appear to 
> be scattered over numerous posts, mixed in with other text, 
> opinions, and handwavy stuff. There's nothing to point to that 
> is "the proposal".

The proposal is:

Implicit conversion _to_ shared, e.g. passing it to a thread 
entry point, and not implicit conversion _from_ shared (just like 
implicit const conversions).

Shared disables reads and writes

  Your confusion results from the use of atomic add which, in 
Manu's examples had a different signature than before.

> I suggest you and Manu write up a proper proposal. Something 
> that is complete, has nothing else in it, has a rationale, 
> illuminating examples, and explains why alternatives are 
> inferior.

We will eventually. This started as a "please point out any 
problems with this" and has probably outlived that phase.

> Trying to rewrite the semantics of shared is not a simple task,

Not as much as trying to explain it! Having talked to Manu in 
person it is much easier to understand.

> doing multithreading correctly is a minefield of "OOPS! I 
> didn't think of that!"

The above case in point, this is about assuming your 
implementation of thread safe primitives are thread safe 
(@trusted) that you use it correctly (@safe).




More information about the Digitalmars-d mailing list