Case Range Statement ..

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Jul 7 14:16:10 PDT 2009


Ary Borenszweig wrote:
> Jarrett Billingsley wrote:
>> On Tue, Jul 7, 2009 at 4:15 PM, Andrei
>> Alexandrescu<SeeWebsiteForEmail at erdani.org> wrote:
>>> Jarrett Billingsley wrote:
>>>> On Tue, Jul 7, 2009 at 3:49 PM, Jarrett
>>>> Billingsley<jarrett.billingsley at gmail.com> wrote:
>>>>> On Tue, Jul 7, 2009 at 3:38 PM, Walter 
>>>>> Bright<newshound1 at digitalmars.com>
>>>>> wrote:
>>>>>> Nick Sabalausky wrote:
>>>>>>>  Someone else said it's also an expression
>>>>>>> that evaluates to 3, but that seems beyond useless to me.
>>>>>> It's handy when you want to prefix one expression to another, as in:
>>>>>>
>>>>>>  (foo(), x + 3)
>>>>> Cause you want to do that so often, after all.
>>>>>
>>>>> *snort*
>>>> A more constructive reply: tuuuuples.  TUPLES.  Returning them!  Using
>>>> them as first-class values!  Yes.
>>> Just prepend "tuple" and you're home at a low price.
>>
>> I can't return tuples.  I have to wrap them in a struct.  If I do
>> that, then I can't index the struct as if it were a real tuple.  Okay,
>> then I use 'alias this', and I end up with this struct that exists for
>> no purpose other than to get around a silly limitation in the type
>> system.  Well, geez!  Why not just make tuples first-class?
> 
> Yeah, really. The TupleType already exists in the compiler, but just 
> can't be expressed and passed around in the language.

It can be expressed, just not as a literal. Use TypeTuple. (By the way 
there's some confusion in this discussion about Tuple vs. TypeTuple.)

Andrei



More information about the Digitalmars-d mailing list