June 19, 2008 Re: DMD 1.031 and 2.015 releases | ||||
---|---|---|---|---|
| ||||
Walter Bright Wrote:
> 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.
(Apologies for the web interface)
Any way to rewrite them as no-parameter templates automatically if possible and issue a sensible compiler message if they can't be (i.e. a virtual function).
|
June 19, 2008 Re: DMD 1.031 and 2.015 releases | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robert Fraser | Robert Fraser wrote:
> Any way to rewrite them as no-parameter templates automatically if possible and
> issue a sensible compiler message if they can't be (i.e. a virtual function).
It's not impossible, but there's too much else to do at the moment.
|
Copyright © 1999-2021 by the D Language Foundation