Fields with the same name not causing a warning?
Dennis
dkorpel at gmail.com
Fri Nov 16 19:12:42 UTC 2018
On Friday, 16 November 2018 at 18:37:00 UTC, Vinay Sajip wrote:
> Design flaws in what?
Design flaws in the language.
Quoting Jonathan M Davis:
"Honestly, in general, warnings are a terrible idea. Anything
that's a warning in your code has to be fixed, because it's bad
practice to leave warnings in your code, meaning that ultimately,
there's not much difference between a warning and an error. To
make matters worse, there's a compiler flag that turns warnings
into errors. And when you combine that with stuff like
is(typeof(...)) and template constraints, whether you use that
compiler flag or not could actually change the resulting program.
So, as it stands, warnings are an even worse idea in D than they
are in other languages. Walter likes to talk about how warnings
in C/C++ are there simply because folks couldn't agree on what
should or shouldn't be an error in the language.
If something is definitively wrong, then it should be an error.
If it's not definitively wrong, then the compiler shouldn't say
anything about it, and it should be left up to a linter tool of
some kind like dcd."
https://forum.dlang.org/post/mailman.3986.1537881312.29801.digitalmars-d@puremagic.com
The language design could be fixed by requiring the use of the
`override` keyword like in C#. However, in D it *might* make
generic code (with mixins) more complicated, though I personally
have never found a use for hiding member variables so I don't
know the rationale.
More information about the Digitalmars-d-learn
mailing list