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

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Sep 24 09:51:18 PDT 2012


On 9/24/12 11:47 AM, Steven Schveighoffer wrote:
> On Mon, 24 Sep 2012 11:29:53 -0400, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>
>> On 9/24/12 11:23 AM, Eldar Insafutdinov wrote:
>>> On Monday, 24 September 2012 at 14:52:21 UTC, Steven Schveighoffer
>>> wrote:
>>>> Without any research or investigation, what about using a different
>>>> set of delimiters for tuples? Like {1,2,3}
>>>
>>> .... and exactly the syntax I was going to propose!
>>
>> Assume you had this syntax working today. So instead of writing
>> "tuple(a. b. c)" you write "{ a, b, c }". To what extent would your
>> code be better? (Honest question. Don't forget that adding the =>
>> syntax for lambda /did/ make for better code.)
>
> I can't honestly say I've used either tuple(a, b, c), or tuples in other
> languages very much.
>
> I can say that I have *avoided* tuples as return values because I don't
> want to type Tuple!(x, y) as the return type. But I haven't come across
> that need very much. You can say "yeah, but what about auto?" Cases I'm
> referring to were to make interface declarations -- can't use auto.

Yah, after writing DIP19 I was like, "creating tuples is nice and easy, 
but expressing function returns is less so". Besides, the comma operator 
does not hurt the syntax for types all that much.

> I just wanted to point out that it seems the largest trouble,
> implementation-wise, for DIP19 is the choice of parentheses to denote a
> tuple. If we do want to add built-in tuples, maybe we should be looking
> at a different delimiter.

Indeed. The question is what mileage we get out of it.


Andrei




More information about the Digitalmars-d mailing list