Lambda vs. function

Maciej Stachowiak mjs at apple.com
Tue Oct 21 16:43:42 PDT 2008


On Oct 20, 2008, at 2:23 PM, Dave Herman wrote:

>> Yes, that's what I was referring to earlier.  Do you now understand  
>> my
>> mail from 10/17/2008 12:39?
>
> You mean these examples?
>
>> lambda h(x) {
>> switch (x) {
>>   case 1:
>>     g();
>>     break;
>>   case 2:
>>     ...
>> }
>> }
>
> I doubt there's any clean way to fit tail positions into a switch
> statement, since it works by jumping out of the statement. I'll have  
> to
> look closer at the semantics of the completion value of a switch
> statement; there might be some reasonably straightforward notion of a
> tail position. But I doubt it.

I don't think you can represent tail position in a switch statement  
with your "attribute grammar" notion, but it's clear to me that the  
statement immediately before a break statement, or else the last  
statement in the last case or default clause, is in tail position.  
There is no reason this should be any different than the if/else case.

Regards,
Maciej



More information about the Es-discuss mailing list