Constructor params with same name as members

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 23 01:15:52 PDT 2014


Jonathan M Davis:

> Questions like this have come up and been discussed before, but 
> using the same parameter names as member variable names for 
> constructors is such a common practice that there would be 
> quite a bit of screaming if we didn't allow it.

I'm willing to hear them scream. D should statically forbid such 
kind of code. I have had many (usually quick to find) bugs caused 
by this.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list