Notes on the Phobos style guide

Kagamin spam at here.lot
Mon Aug 16 23:17:49 PDT 2010


bearophile Wrote:

> > * In D, use of auto is recommended unless you want to make a
> > specific point by mentioning the type.
> 
> On the other hand code needs to be read too, sometimes by people that have not written it. In this case seeing the actual types used is often better. So using "auto" everywhere makes the code reading harder: if you aren't using an IDE that tells you types, you sometimes need to follow the flux of the various calls until you find what is the type, or sometimes you need to add temporary writeln(typeof(x).stringof); inside the code to see what type it is. This problem is common in dynamic languages.
> 
I agree. Auto hinders understanding. Knowing that we have some fancy type here gives you no knowledge about what's going on. Even with IDE. It also has issues with interoperability. You don't want to pass fancy types to the external code, do you?
It also contradicts with the intention to have uniform style because this is an intention to have understandable code.


More information about the Digitalmars-d mailing list