On Tuesday, 25 June 2024 at 02:16:25 UTC, mw wrote:
Why `foo.x.saa.aa` and `foo.y.saa.aa` is the same? (and of course print out the same contents).

`shared_AA.saa` should still be instance variable, not class variable, right?

`saa` is an instance variable, but both `foo.x.saa` and `foo.y.saa` are initialized to the same instance of `shared_AA_class`. I think in the next edition of D we can forbid tail mutable initializers.

BTW there's also another issue that the initializer is not TLS - that could probably be fixed (also in an edition) to use TLS.

https://forum.dlang.org/post/sexmkjnbtxvsvodca...@forum.dlang.org
  • Why `foo.x.saa.a... mw via Digitalmars-d-learn
    • Re: Why `fo... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
      • Re: Why... mw via Digitalmars-d-learn
        • Re:... Kagamin via Digitalmars-d-learn
        • Re:... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
    • Re: Why `fo... Nick Treleaven via Digitalmars-d-learn

Reply via email to