On Monday, December 24, 2012 12:07:53 Jacob Carlborg wrote: > On 2012-12-23 23:16, Jonathan M Davis wrote: > > But with return types, it affects the documentation and people's ability > > to > > figure out what a function does, so as useful as auto return types can be, > > they come with a definite cost and should be avoided if they're not > > needed. > The compiler should be able to replace "auto" with the actual type when > generating documentation.
That would be horrible. Do you remember what std.algorithm looked like before we were able to put auto in the documentation? It scared most everyone who looked at it. We don't _want_ the actual return type in the docs. auto return types makes std.algorithm digestible. And with some functions, they literally return completely different types depending on their arguments, making it impossible for the compiler to pick anything for the return type. - Jonathan M Davis
