auto

Jason House jason.james.house at gmail.com
Thu Aug 13 06:10:09 PDT 2009


Ary Borenszweig Wrote:

> Jarrett Billingsley wrote:
> > On Wed, Aug 12, 2009 at 9:18 AM, Ary Borenszweig<ary at esperanto.org.ar> wrote:
> >> This compiles and runs in D2:
> >>
> >> --
> >> import std.stdio;
> >>
> >> auto foo() {
> >>    return 1;
> >> }
> >>
> >> void main() {
> >>    writefln("%s", foo());
> >> }
> >> --
> >>
> >> Since when a non-templated function can have its return type deduced? :)
> > 
> > Cool.  I'm testing this and it really does seem to be non-templated.
> > So of course, the first thing I tried was this:
> > 
> > class A
> > {
> >     auto foo() { return 0; }
> > }
> > 
> > class B : A
> > {
> >     auto foo() { return 5; }
> > }
> > 
> > but DMD crashes.  :P
> 
> Now that it also works in Descent I can see it's because function 
> overloading is treated before function return type inference, and the 
> return types for the functions at those moments are null...

When can we look forward to Descent for D2? :)

Also, what kind of porting issues did you have? How could it be made simpler? I'm assuming that whatever makes your work easier also helps others customizing their applications for D2.



More information about the Digitalmars-d mailing list