I wish all qualifiers were revisited with an eye for simplification

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Aug 3 01:23:26 UTC 2020

On 8/2/20 6:55 PM, Stefan Koch wrote:
> On Sunday, 2 August 2020 at 20:50:14 UTC, Andrei Alexandrescu wrote:
>> (Background: qualifiers were introduced following my horror when I 
>> started writing D1 code and saw that strings are represented as 
>> char[]. So structs with string members would look like:
>   [lots of stuff]
> const inout shared T is simply the same as const shared T.

Sadly no: https://run.dlang.io/is/etdPtP

> shared means simply: this is not thread local,
> therefore this thing might be used by other threads
> therefore you read or write it in an expression directly.
> You can however have a function take a shared argument and leave
> the scheduling or locking or whatever synchronization you use,
> to enact an operation in a safe way.

Yes, the intent was generous. The realization, not quite. However, I did 
learn from Walter that a number of invalid operations on shared numerics 
have now been disabled. However, copying a shared int into an int is 
allowed and as far as I know with no special treatment:


At least on ARM that should generate a read barrier.

More information about the Digitalmars-d mailing list