Tuple literal syntax
bearophile
bearophileHUGS at lycos.com
Sun Oct 10 09:13:49 PDT 2010
Andrei:
> Tuples with named fields are restricted in a number of ways compared to
> structs. They are expandable, they have indexed fields, they offer no
> encapsulation, etc. Lambda structs would be rather unwieldy. I
> personally am fine with tuples.
Now the discussion is developing in a slower and more relaxed way. Have Walter and you reached some partial conclusion on this subject? I am not asking for the final words on this topic, because I probably few further discussions will be needed, but other people and I have already expressed several opinions and ideas. I think that multiple return values and a nice clean packing & unpacking syntax for tuples may be useful for D (especially if it can be used for unpacking in foreach and function signatures too). And It's just syntax sugar, yet I think a good syntax sugar for this is able to change the taste of the D language, because if it's good and efficient, it will probably be used very often, in normal Python code it's not hard to find one or more tuples every 3-8 lines of code, a normal Python module may contain a fifty tuple literals (often just as "return x, y").
Bye,
bearophile
More information about the Digitalmars-d
mailing list