Andrei Alexandrescu:

> If we avoid "auto" in documentation examples but we do use it in 
> everyday code, we effectively foster a style that's foreign and 
> non-idiomatic to newcomers.
> 
> Sample code should mimic real code. If real code would use auto, sample 
> code should use auto.

D programmers are probably able to learn to use auto later, because it's handy, 
it's an attractor. On the other hand one of the main purposes of the online 
documentation is to be as clear as possible. D written by newbies is not the 
same D written by D experts. But documentation must be written for D newbies 
too, because they are ones that have more need of documentation. The code 
written in the thousands of examples in the very good Pascal/Delphi docs was 
written in a clear style that is not the same compact style an expert Delphi 
programmer writes code. So I'd like D docs to avoid auto when the types are not 
very clear. The purpose of the docs is not to shows examples of idiomatic D 
code written by experts.

Bye,
bearophile

Reply via email to