DMD 1.031 and 2.015 releases
Walter Bright
newshound1 at digitalmars.com
Wed Jun 18 08:37:32 PDT 2008
Robert Fraser wrote:
> Out of curiosity, why doesn't return type deduction work for all
> functions (is this panned?). It seems to be possible to do:
>
> auto foo()()
> {
> return 10;
> }
>
> but not:
>
> auto foo()
> {
> return 10;
> }
Good question!
Because deducing the return type requires semantic analysis, and for
functions that introduces the old forward reference chicken-and-egg
problem. This doesn't happen with function templates, because semantic
analysis of them doesn't happen until later.
More information about the Digitalmars-d-announce
mailing list