Frustratingly D

bearophile bearophileHUGS at lycos.com
Tue Feb 22 16:15:06 PST 2011


Nicholas:

> auto a = obj.method( "guess what i'm returning" );
> 
> 
> I like auto.  I use it sometimes.  But it's not always clear what's taking
> place in the examples.  I believe you should exclude auto from all examples
> except when explaining auto.

Unfortunately this happens in normal code too, not just in examples. auto is practically necessary when you use lazy iterables, because their type is usually too much complex to write, but in the other cases it obfuscates the code a little.

In dynamic languages it's like using auto everywhere. But programmers of dynamic languages survive because they program in a way that makes the implicit types a bit more easy to guess :-) D code that uses "auto" a lot needs to be written in the same way, with very well chosen variable names, etc.

Bye,
bearophile


More information about the Digitalmars-d mailing list