lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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:

http://en.wikipedia.org/wiki/Icon_(programming_language)#Goal-directed_execution

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...

  Cheers,
    Eduardo Ochs
    http://angg.twu.net/


On Tue, Dec 16, 2014 at 10:59 PM, Sean Conner <sean@conman.org> 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 ...
>>       end
>>
>>   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 ... )
>
>