Declaring Ref Variables Inside Function Calls

dsimcha dsimcha at yahoo.com
Tue Mar 31 09:31:14 PDT 2009


== Quote from Jarrett Billingsley (jarrett.billingsley at gmail.com)'s article
> 2009/3/30 dsimcha <dsimcha at yahoo.com>:
> > // How it works now:
> > uint foo;
> > string bar;
> > unpack(foo, bar) = someFunction();
> >
> > // vs. how I want it to work:
> > unpack(auto foo, auto bar) = someFunction();
> Cute, but uh, I'd much rather see tuples just be returnable.  That
> would practically remove the need for out parameters, and would remove
> the need for this request as well (since that's about the only time
> you'd need it).

Well, apparently, alias this is getting implemented soon (see Phobos changelog on
dsource), which for all practical purposes gives returnable tuples because the
Tuple struct in std.typetyple can be made to look exactly like a builtin tuple.  I
assume you mean automatic unpacking of tuples.  Not sure if there's any good
reason other than higher priority stuff to implement first why this doesn't
already exist.



More information about the Digitalmars-d mailing list