Tuple [] operator

Ali Çehreli acehreli at yahoo.com
Mon Aug 8 13:38:25 PDT 2011


On Mon, 08 Aug 2011 20:32:03 +0000, Ali Çehreli wrote:

>> the point is, the compiler has no idea what the lvalue expression's
>> type should be when you do:
>> 
>> a[x] = 1;
>> 
>> is it short or int?
>> 
>> so the compiler must *know* what type x is at compile time in order for
>> this to be valid.
> 
> I think it's more import for the compiler to know what type a[x] is. The
> assignment operators of different types are different. On the other
> hand, I don't think a short vs int would make a difference when it comes
> to indexing (it shouldn't anyway).
> 
> 
>> -Steve
> 
> Ali

I correct myself before Steve does: I missed the "lvalue" above. Steve 
meant a[x] anyway.

Ali


More information about the Digitalmars-d-learn mailing list