Re: Unintuitive behavior with shared classes & template member functions; is this intended?

2022-01-16 Thread Jaime via Digitalmars-d-learn
On Saturday, 15 January 2022 at 02:52:20 UTC, Steven Schveighoffer wrote: you probably can fix the issue via: ```d class C { shared: ... // everything } ``` This seems like a good solution. To achieve implicit sharing on the aggregate itself, I can use this approach to define a

Re: Unintuitive behavior with shared classes & template member functions; is this intended?

2022-01-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/14/22 6:10 PM, Jaime wrote: Why does this happen? Is it intended behavior? I'm still somewhat new to D, so I'm not prepared to submit this as an issue quite yet; for all I know, there might be a good reason it works this way. This seems like a bug to me. This confusing problem really

Unintuitive behavior with shared classes & template member functions; is this intended?

2022-01-14 Thread Jaime via Digitalmars-d-learn
Some code that produces the strange behavior I'm seeing: ```d shared class MyClass { this() {} this(As...)(As args) if (As.length > 0) {} } void main() { pragma(msg, typeof(new MyClass)); pragma(msg, typeof(new MyClass(1, 2, 3, "hello world"))); pragma(msg, typeof(new