Tuple literal syntax

bearophile bearophileHUGS at lycos.com
Sun Oct 10 07:33:35 PDT 2010


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


More information about the Digitalmars-d mailing list