Tuple unpacking syntax [Was: Re: Multiple return values...]

Derek Parnell ddparnell at bigpond.com
Tue Mar 13 20:25:06 PDT 2012


On Wed, 14 Mar 2012 13:33:18 +1100, Kevin Cox <kevincox.ca at gmail.com>  
wrote:

> Kind of unrelated but I think that it is important to have a way to  
> ignore
> values also.  Leaving them bank would sufice.
>
> (int i,,float f) = intBoringFloat();

For what its worth, the Euphoria Programming Language uses ? to signify  
ignored values.

eg.

   integer i
   atom    f
   {i, ?, f} = intBoringFloat()


We felt that leaving a blank could be a source of human error (can be  
missed when reading code) and also a result of human error (accidentally  
put in a double comma).  Using an unusual glyph to signify omission was  
the compromise we came up with.

-- 
Derek Parnell


More information about the Digitalmars-d mailing list