Tuple literal syntax

Denis Koroskin 2korden at gmail.com
Sun Oct 10 07:44:08 PDT 2010


On Sun, 10 Oct 2010 18:33:35 +0400, bearophile <bearophileHUGS at lycos.com>  
wrote:

> Denis Koroskin:
>
>> I don't mind having Tuple in a library, as long as I'm not insisted in
>> using it *and* it doesn't affect other language features.
>
> More modern module-based languages as D are not like C. If they want  
> some success they develop a community of programmers that share modules.  
> You don't program in a vacuum any more. This means that if Tuple is  
> appreciated and used by the community, then you will often use modules  
> (including frequently stuff from Phobos2) written by other people that  
> expect tuples as input values or that return tuples as outputs and so  
> on. So if tuples have success, you will probably need to use them in  
> your code too, they become an idiom of the language almost as they are  
> built-ins, this is also why it's better to give them a good syntax.
>
> Multiple return values have the disadvantage that sometimes your don't  
> exactly remember what each value is, but they are handy, and overall  
> they are an improvement over C-style single return values. In a recent  
> post I've shown why they may also help avoid some bugs compared to "out"  
> arguments.
>
> Bye,
> bearophile

I was referring *only* to Tuple!(int, "foo", float, "bar") syntax. I'd  
love having proper tuples (Python-style or similar) support in D, and use  
it to the maximum. But Tuple!? Meh.


More information about the Digitalmars-d mailing list