Phobos examples and auto

Alex Rønne Petersen xtzgzorex at gmail.com
Sat Nov 5 12:13:12 PDT 2011


On 05-11-2011 18:42, Steve Teale wrote:
> There's a growing tendency in Phobos documentation to use auto.
>
> auto now = Clock.currTime();
>
> Now I can understand that when the RHS is some obscure template, whose
> type might not be immediately obvious, the user should possibly be
> encouraged to RTFM. But if the outcome is deterministic I just have the
> feeling that documentation should provide information rather than hiding
> it.
>
> OK, in Jonathan's example, this is preceded by a sentence that says that
> the result is a SysTime. But the auto made me forget, and wonder what it
> was, rather than reinforcing the preceding sentence.
>
> I realize that this is probably a trivial point, but at the same time, in
> documentation, clarity is wonderful.
>
> Steve

I agree on this. auto is useful when writing code; less so when reading 
it (especially if RHS is not a 'new' expression).

- Alex


More information about the Digitalmars-d mailing list