Shared - Another Thread

Stanislav Blinov stanislav.blinov at gmail.com
Thu Oct 18 21:14:54 UTC 2018


On Thursday, 18 October 2018 at 20:59:59 UTC, Erik van Velzen 
wrote:
>
> Let me start by saying I'm willing to admit that I was 
> factually wrong.
>
> Also keep in mind that "me having an impression" is something 
> that is can't be independently verified and you'll have to take 
> my at my word. Just that the exact reason for that impression 
> was lost to the sands of time.

Quite a simple reason: it was years ago, however old you are now 
you were younger and less experienced, and probably didn't 
understand something back then.

>> Your impression was wrong. Open e.g. TDPL and read up on 
>> `shared` how it was envisioned back then.
>
> I don't think the book really supports your argument. The first 
> paragraph about shared sound to me like "the compiler will 
> automagically fix it".

Then I don't know what to tell you. It literally talks about 
compiler forbidding unsafe operations and *requiring* you to go 
the extra mile, by just rejecting invalid code (something that 
Manu is proposing to forego!). But that's *code*, not logic.

> Only tangentially it is mentioned that you're actually supposed 
> to write special code yourself. You would have to be a compiler 
> expert to draw the correct conclusion.

Tangetially?! There's a whole section on writing `shared`-aware 
code (none of which would even compile today, I don't know if 
it's addressed in his errata).

> Also the last paragraph the quote below is interesting in light 
> of our other discussion about casting to shared.
>
> From  the book:
>
> [snip]

Yeah, some of that never happened and never will. But that aside, 
none of it says "threading will be safe by default". It says 
"threading will be a lot less unsafe by default". And *that* is 
what we must achieve.


More information about the Digitalmars-d mailing list