On Wednesday, 6 August 2014 at 02:12:16 UTC, Era Scarecrow wrote:
On Tuesday, 5 August 2014 at 17:41:06 UTC, Marc Schütz wrote:
It's a consequence of the fact that every type in D has a default initializer which is known at compile time.

Then doesn't this mean it should pop out a warning in case that's the behavior you wanted, perhaps a reference to the D specs?

Beyond that it would be easy to forget it does that, since class initializes things different than structs because of the 'known at compile time' logic.

It wouldn't make sense to warn about that, because it could be very legitimately be what the programmer wants to do. We can't warn about anything that would be legitimate to have, because it would force programmers to change their code to get rid of the warning, even when the code was valid. So, while in most cases, it might be a problem, we can't warn about it. But I do think that the spec should be clearer about it.

- Jonathan M Davis

Reply via email to