[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: goto in expressions
- From: Eduardo Ochs <eduardoochs@...>
- Date: Wed, 17 Dec 2014 00:40:21 -0200
If we are heading towards a patch that allows return and goto
in expressions, let me say something: I would LOVE to have that
available! I used Icon for years, and it was a joy to use, especially
because of this:
That patch would make it easy to implement goal-directed
execution in Lua. The default syntax will be somewhat clumsy,
but preprocessors are easy (and fun) to write...
On Tue, Dec 16, 2014 at 10:59 PM, Sean Conner <email@example.com> wrote:
> It was thus said that the Great Sean Conner once stated:
>> which immediately shows a problem (or at least I see a problem):
>> function foo(x,y)
>> local x,y = x or return nil,"error",y --- ... um ...
>> Question: if you call foo(nil,3) does this return nil or nil and "error"?
>> If you call foo(2,2) is x 2 and y "error", or 2? Well, parenthesis can
>> clear that up:
>> local x,y = x or (return nil,"error") , y
> Actually, the parenthesis may not fix the problem---that might require
> another language change. But *this* is allowed:
> local x,y = x or return nil,"error";,y
> So we're still good.
> -spc (Um ... more or less ... )