DIP19: Remove comma operator from D and provision better syntactic support for tuples

Jacob Carlborg doob at me.com
Mon Sep 24 02:14:06 PDT 2012


On 2012-09-24 00:11, bearophile wrote:
> This is a complex topic, and in this post I am not able to discuss
> everything that needs to be discussed. So I will discuss only part of
> the story.
>
> First: tuples are important enough. I think they should be built-in in a
> modern language, but maybe having them as half-built-in will be enough
> in D. Currently in D we have (deprecated) built-in complex numbers that
> I use only once in a while, and half-usable library defined tuples that
> I use all the time.
>
> Second: removing comma operator from D has some advantages unrelated to
> tuple syntax. Even disallowing bad looking C-like code that uses commas
> is an improvement by itself (but maybe it's not a big enough
> improvement...).
>
> Third: replacing the packing syntax tuple(x,y) with (x,y) is nice and
> maybe even expected in a partially functional language as D, but that's
> _not_ going to improve D usability a lot. What I am asking for is
> different: I'd like D tuples to support handy unpacking syntax:
>
> 1) In function signatures;
> 2) In foreach;
> 3) At assignment points;
> 4) In switch cases.

+1

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list