Case Range Statement ..

Bill Baxter wbaxter at gmail.com
Thu Jul 9 19:56:21 PDT 2009


On Thu, Jul 9, 2009 at 7:08 PM, Walter Bright<newshound1 at digitalmars.com> wrote:
> Jérôme M. Berger wrote:
>>
>> Walter Bright wrote:
>>>
>>> Nick Sabalausky wrote:
>>>>
>>>> "Walter Bright" <newshound1 at digitalmars.com> wrote in message
>>>>>
>>>>> It's handy when you want to prefix one expression to another, as in:
>>>>>
>>>>>   (foo(), x + 3)
>>>>
>>>> I guess I'm not familiar with that syntax. What does that do and for
>>>> what purpose?
>>>
>>> They're called Comma Expressions, and the left operand is evaluated
>>> first, its result discarded, then the right operand is evaluated and forms
>>> the type and result of the Comma Expression.
>>>
>>    I've always felt they were useless and confusing. What's the advantage
>> of "y = (foo(), x + 3);" over "foo(); y = x+3;"?
>
> When you only see the x+3 because you're recursively walking the tree
> generating code.

If it's internal to the parse tree can't you make the syntax whatever you want?
Something like (expr1 __exprSequencer expr2) should do just fine, right?
No reason it has to be a precious one-character symbol syntax.

--bb



More information about the Digitalmars-d mailing list