September 13, 2003
What about introduction of tuple in D version 2 ?

So function/method take a tuple as parameter and return a tuple. keyword "void" no longer exists, replaced by "()", the empty tuple.

it will solve many common problems.

// iterate over associative array
foreach( ( char[] key ,char[] value ) ; array.pairs )
    printf("%.*s -> %.*s\n" , key, value );

// swap
(a,b) = (b,a);

// mutiple return value
(int x,int y) = getCoord();


-- Nicolas Repiquet



September 14, 2003
We're certainly going to need some mechanism when freaching (a new term?)
associative containers.

"DeadCow" <deadcow-remove-this@free.fr> wrote in message news:bjvfca$1dkf$1@digitaldaemon.com...
> What about introduction of tuple in D version 2 ?
>
> So function/method take a tuple as parameter and return a tuple. keyword "void" no longer exists, replaced by "()", the empty tuple.
>
> it will solve many common problems.
>
> // iterate over associative array
> foreach( ( char[] key ,char[] value ) ; array.pairs )
>     printf("%.*s -> %.*s\n" , key, value );
>
> // swap
> (a,b) = (b,a);
>
> // mutiple return value
> (int x,int y) = getCoord();
>
>
> -- Nicolas Repiquet
>
>
>