Re: Why `foo.x.saa.aa` and `foo.y.saa.aa` is the same? `shared_AA.saa` should still be instance variable, not class variable, right?

2024-06-25 Thread mw via Digitalmars-d-learn
On Wednesday, 26 June 2024 at 01:17:01 UTC, mw wrote: On Tuesday, 25 June 2024 at 21:13:44 UTC, Nick Treleaven wrote: I think in the next edition of D we can forbid tail mutable initializers. It is still (or maybe only) useful for fields of a singleton class. But a compiler warning

Re: Why `foo.x.saa.aa` and `foo.y.saa.aa` is the same? `shared_AA.saa` should still be instance variable, not class variable, right?

2024-06-25 Thread mw via Digitalmars-d-learn
On Tuesday, 25 June 2024 at 21:13:44 UTC, Nick Treleaven wrote: I think in the next edition of D we can forbid tail mutable initializers. It is still (or maybe only) useful for fields of a singleton class.

Re: Why `foo.x.saa.aa` and `foo.y.saa.aa` is the same? `shared_AA.saa` should still be instance variable, not class variable, right?

2024-06-25 Thread mw via Digitalmars-d-learn
On Tuesday, 25 June 2024 at 21:13:44 UTC, Nick Treleaven wrote: 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?

Re: Why `foo.x.saa.aa` and `foo.y.saa.aa` is the same? `shared_AA.saa` should still be instance variable, not class variable, right?

2024-06-25 Thread Nick Treleaven via Digitalmars-d-learn
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

Re: Why `foo.x.saa.aa` and `foo.y.saa.aa` is the same? `shared_AA.saa` should still be instance variable, not class variable, right?

2024-06-25 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 25/06/2024 3:38 PM, mw wrote: Why D choose to be different here? i.e. |shared_AA_class saa = new shared_AA_class()| only evaluate only once, and even force it must be evaluate-able at compile time? That has nothing to do with it. Every type in D has an initialized value, that everything

Re: Why `foo.x.saa.aa` and `foo.y.saa.aa` is the same? `shared_AA.saa` should still be instance variable, not class variable, right?

2024-06-25 Thread Kagamin via Digitalmars-d-learn
It's a bug.

Re: Why `foo.x.saa.aa` and `foo.y.saa.aa` is the same? `shared_AA.saa` should still be instance variable, not class variable, right?

2024-06-24 Thread mw via Digitalmars-d-learn
On Tuesday, 25 June 2024 at 02:25:14 UTC, Richard (Rikki) Andrew Cattermole wrote: On 25/06/2024 2:16 PM, mw wrote: struct shared_AA {   shared_AA_class saa = new shared_AA_class();  // by this syntax `saa` is still instance variable?   alias saa this; } When you specify an initializer

Re: Why `foo.x.saa.aa` and `foo.y.saa.aa` is the same? `shared_AA.saa` should still be instance variable, not class variable, right?

2024-06-24 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 25/06/2024 2:16 PM, mw wrote: struct shared_AA {   shared_AA_class saa = new shared_AA_class();  // by this syntax `saa` is still instance variable?   alias saa this; } When you specify an initializer like this, that instance of ``shared_AA_class`` gets put into the .init of

Why `foo.x.saa.aa` and `foo.y.saa.aa` is the same? `shared_AA.saa` should still be instance variable, not class variable, right?

2024-06-24 Thread mw via Digitalmars-d-learn
Sorry about the silly code, but I just tried this: ``` $ cat shared_aa.d import std; synchronized class shared_AA_class { private: int[int] aa; alias aa this; public: void print() { writeln(, aa); } } struct shared_AA { shared_AA_class saa = new shared_AA_class(); // by