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

Nick Sabalausky SeeWebsiteToContactMe at semitwist.com
Mon Sep 24 03:06:12 PDT 2012


On Mon, 24 Sep 2012 10:56:40 +0200
Jacob Carlborg <doob at me.com> wrote:

> On 2012-09-24 07:01, Nick Sabalausky wrote:
> 
> > I think one of us is missing something, and I'm not entirely sure
> > who.
> >
> > As I explained (perhaps poorly), the zero- and one-element tuples
> > *would still be* tuples. They would just be implicitly convertible
> > to non-tuple form *if* needed, and vice versa. Do you see a reason
> > why that would *necessarily* not be the case?
> 
> Would that mean you could start doing things like:
> 
> int a = 3;
> int b = a[0];
> 
> That feels very weird.
> 

No, because there's nothing typed (int) involved there. But you could do
this:

    int a = 3;
    (int) b = a;
    a = b;

Or this:

    void foo((int) a)
    {
        int b1 = a[0];
        int b2 = a;
    }
    int c = 3;
    foo(c);





More information about the Digitalmars-d mailing list