shared - no read/write access

Rubn where at is.this
Tue Mar 19 20:35:14 UTC 2019


On Tuesday, 19 March 2019 at 20:16:03 UTC, Jacob Carlborg wrote:
> On 2019-03-19 21:08, Manu wrote:
>> Last time we talked about shared, I think we all agreed on one 
>> thing;
>> shared should hot have read/write access to data members.
>
> Not exactly sure of what you're looking for but write access is 
> already disable [1].
>
>> Does anyone know how to implement this? I would really like to 
>> try
>> some important experiments with shared if it worked.
>
> If it's only the read access that is left to disable I 
> recommend looking at how the write access is disable and try to 
> do the same for read. I suggest to do a project wide search for 
> the error message for write operations, seems pretty unique. 
> Then go from there.
>
> [1] https://run.dlang.io/is/ZJ5maE

Only read-write-modify are disabled, you can still write as long 
as you don't read from it at the same time.

shared int global;

shared class Foo
{
     int a;
}

void main()
{
     auto foo = new shared Foo;
     foo.a = 1;
}



More information about the Digitalmars-d mailing list