Phobos examples and auto

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Nov 5 15:48:54 PDT 2011


On 11/5/11 5:41 PM, Dejan Lekic wrote:
> On Sat, 05 Nov 2011 14:49:11 -0500, Andrei Alexandrescu wrote:
>
>>
>> Sample code should mimic real code. If real code would use auto, sample
>> code should use auto.
>>
>
> It is tricky because people have different styles... I try to avoid auto
> as much as possible because I find myself wasting time trying to find out
> what the type actually is. Even in the simplest case - when you see auto,
> you must always look right and try to find what the type is. However,
> when you see<type>  <name>, you know immediately what type the<name>
> is... I believe it saves me (and whoever is reading my code) time in the
> long run. I do not mind extra typing. :)

Most everyone agrees that sometimes specifying a type, even if 
redundant, is helpful. There are people who think those cases form all 
or a majority of all instances (and hence auto should be avoided), but I 
have reasons to believe they're a minority.

Andrei


More information about the Digitalmars-d mailing list