On Saturday, 16 March 2024 at 13:47:42 UTC, Timon Gehr wrote:
>On 3/14/24 15:44, Matheus wrote:
>On Thursday, 14 March 2024 at 12:00:37 UTC, Basile B. wrote:
>On Thursday, 14 March 2024 at 10:21:41 UTC, Jonathan wrote:
>The following seems the be the minimum required for this problem to pop up. I've changed the names to what I'm using in my code to make it more clear for me.
[...]
Classic. Instead of a static initializer rather uses a constructor for instances.
class Spectrum
{
PrecursorList precursorList;
this()
{
precursorList = new PrecursorList();
}
}
I wonder how it would be if we had an error or warning for something like this. For example displaying a message forcing the use of the word "static" and initialize with "static this" when expecting static initialization or construct for new instances.
Before someone points out: https://dlang.org/spec/class.html
Yes I know, but unfortunately this mistake as Basile noted as "classic", is very common.
Well, I guess I can still point out that this is what OpenD does:
https://github.com/opendlang/opend/pull/8
Too common.