Preparing for the New DIP Process

Max Samukha maxsamukha at gmail.com
Thu Jan 25 15:03:41 UTC 2024


On Monday, 22 January 2024 at 23:28:40 UTC, Jonathan M Davis 
wrote:

>
> Of course, ultimately, different programmers have different 
> preferences, and none of us are going to be happy about 
> everything in any language.

It's not only about preferences. The feature is inconsistent with 
how 'invariant' and 'synchronized' are specified. They imply 
class-instance-level private, while the language dictates 
module-level. Consider:

```
synchronized class C
{
     private int x;
     private int y;

     invariant () { assert (x == y); }
}

void foo(C c)
{
     // mutate c
}
```

With module-level private, 'foo' is part of C's public interface, 
but it neither locks on c, nor runs the invariant checks. I 
personally have no idea how to fix that sensibly except by 
ditching class invariant/synchronized entirely.


More information about the Digitalmars-d-announce mailing list