Multi typed value return.
Matthew Ong
ongbp at yahoo.com
Mon May 16 02:12:22 PDT 2011
On 5/13/2011 12:47 AM, bearophile wrote:
> Matthew Ong:
>
> Any plan to support this really cool feature of Multiple type
> return value?
>
> Multiple return values is a very handy feature, I use it quite often in Python. It makes the code more natural and readable, and avoids some troubles given by "out" arguments. In the D standard library there is a struct-based Tuple. So what's desired is just syntax sugar for the unpacking of a Phobos Tuple, useful for tuples in general, tuples returned by functions, and unpacking of tuples in the foreach, like in foreach((x,y); foo()). We have discussed about tuple unpacking this some time ago and I think Walter& Andrei don't hate the idea of this syntax sugar, but I presume it's not for D2.
>
> Bye,
> bearophile
Yes. Thanks for the Tuple and yes. That will do the job for the time
being. It does beat manually creating a struct and change that later also.
--
Matthew Ong
email: ongbp at yahoo.com
More information about the Digitalmars-d
mailing list