shared - i need it to be useful

Atila Neves atila.neves at gmail.com
Mon Oct 22 14:14:56 UTC 2018


On Monday, 22 October 2018 at 00:22:19 UTC, Manu wrote:
> On Sun, Oct 21, 2018 at 2:35 PM Walter Bright via Digitalmars-d 
> <digitalmars-d at puremagic.com> wrote:
>>
>> Then I don't know what the proposal is. Pieces of it appear to 
>> be scattered over numerous posts, mixed in with other text,
>
> No no, they're repeated, not scattered, because I seem to have 
> to keep repeating it over and over, because nobody is reading 
> the text, or perhaps imaging there is a lot more text than 
> there is.

I've read every post on this thread and I also have the feeling 
that it's scattered. At the very least, I'm 90% confident I don't 
understand what it is you're proposing. Trust me, I'm trying.

I believe that you have a proposal which you believe results in 
@safe multithreaded code. I don't understand how what I've read 
so far would accomplish that. I'm conviced that shared data 
shouldn't be allowed to be written to, but I haven't yet been 
convinced of anything else.

I don't see how it's possible that implicit conversion from 
non-shared to shared can work at all. Yes, I know that in the 
proposal putting `shared` on anything makes it useless, but 
*somehow* that data gets to be used, even if it's by a @trusted 
function that casts away shared. At that point, nothing you do 
thread-safely to the shared data matters if you obtained the 
shared data from an implicit conversion. There may be many many 
aliases to it before it was converted, all of them able to write 
to that memory location believing it's not shared. And it would 
be @safe (but definitely not thread-safe) to do so! This has been 
explained a few times, by multiple people. I haven't seen anyone 
addressing this yet (it's possible it got lost in a sea of text).

I don't even understand why it is you want to cast anything to 
shared anyway - that'd always be a code smell if I saw it during 
code review. If it's shared, type it as such. Or better yet, if 
you can just use immutable.

I understand the frustration of not getting your point across. I 
would like to kindly point out that, if the replies have gotten 
to multiple dozen pages and several well-meaning people still 
don't get it, then the proposal probably isn't as simple as you 
believe it to be.




More information about the Digitalmars-d mailing list