On Saturday, 20 October 2018 at 09:04:17 UTC, Walter Bright wrote:
Somehow, you still have to find a way to give the shared path access, through a gate or a cast or a lock or whatever. And then it breaks, because two different threads are accessing the same data each thinking that data is not shared.

When you say that, then under Manu's proposal and the code below:

class C {
  void f();
  void g() shared;
}

void t1(shared C c) {
  c.g; // ok
  c.f; // error
}

void t2(shared C c) {
  c.g; // ok
  c.f; // error
}

auto c = new C();
spawn(&t1, c);
spawn(&t2, c);
c.f; // ok
c.g; // ok

Do you mean the implementation of C.g? Since that is shared wouldn't that just be a normal understanding that you'd need to synchronize the data access in shared since it's a shared method? And if you mean C.f, then if that accessed data (that was accessed by C.g) unsafely, then that's just a bad implementation no? Or?

Cheers,
- Ali

Reply via email to