Extend D's switch statement?

Vlad Levenfeld via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 10 15:50:32 PDT 2015


On Friday, 10 July 2015 at 21:37:10 UTC, Timon Gehr wrote:
> On 07/10/2015 12:50 AM, Vlad Levenfeld wrote:
>> On Thursday, 9 July 2015 at 16:08:37 UTC, Timon Gehr wrote:
>>> On 07/09/2015 04:17 PM, Timon Gehr wrote:
>>>> On 07/09/2015 02:54 PM, rsw0x wrote:
>>>>> ...
>>>>> someone was willing to produce.
>>>>
>>>> Someone is often willing to produce awkward language quirks, 
>>>> so I think
>>>> being critical of new additions has some value.
>>>
>>> E.g.
>>>
>>> "Note: Cannot swap values by tuple assignment.
>>>
>>> int x = 1, y = 2;
>>> {x, y} = {y, x};
>>> // Lowered to:
>>> // x = y, y = x;
>>> assert(y == 2);
>>> assert(x == 2);"
>>>
>>> No, please.
>>
>> Couldn't this could be detected at compile-time and temporary 
>> variables
>> created?
>
> Oh, it certainly is simple to fix, it's just that we don't want 
> this sort of thing to make it into the language specification.

Why not? Tuple handling seems like it should be a 1st class 
language feature... the disconnect between Tuple and TypeTuple 
always bothered me on a philosophical (and syntactic) level.


More information about the Digitalmars-d mailing list