On 2012-08-26 12:19, Manu wrote:
Looks good, though one thing annoys me as always throughout the D docs,
liberal use of auto can make them very difficult to understand.

auto  result = hash.finish();

 From the examples where this appears, I have absolutely no idea what
'result' could possibly be and what I can do with it, and you're forcing
me to go and dig further for that information (waste of time).
Surely there would be no harm in just writing the type there for clarity?

<rant>
I'd personally like to see auto abolished, or at least heavily
discouraged for the sake of clarity from code examples throughout the
docs. I'm constantly having to chase up what auto's may resolve to when
reading examples >_<
You may argue this demonstrated un-idiomatic code, and my trouble is due
to inexperience; I ask, who is most likely to be reading docs?

I think that in general "auto" shouldn't be used. In some case auto can be used, i.e. where you don't care/don't need to know the actual type and using duck typing instead. If we compare this with OO it would be like using an interface instead of the actual type. I guess in std.algorithm it would be ok to use "auto".

--
/Jacob Carlborg

Reply via email to