[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Begin/End Proposal
- From: David Manura <dm.lua@...>
- Date: Fri, 2 Oct 2009 23:47:28 -0400
On Fri, Oct 2, 2009 at 11:04 PM, Luiz Henrique de Figueiredo wrote:
>> In a recent thread , I brought up the concept of a 'begin' keyword
>> that can be used to create anonymous, argument-less functions.
> Here a token filter in C that does that. Enjoy.
...except for adding the parenthesis, which likely requires keeping
track of the nesting levels to know when to inject the terminal ")" :
prefixexp begin ..... end --> prefixexp ( function() ..... end )
prefixexp : Name begin ..... end --> prefixexp : Name ( function() ..... end )
This is related to the "do patch" , which is one solution to the
short anonymous functions problem . However, using "do" for your
keyword leads to an ambiguity if you also allow omission of
parenthesis: "f () do end" could be one statement or two.