[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: goto in expressions
- From: Sean Conner <sean@...>
- Date: Tue, 16 Dec 2014 19:59:10 -0500
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 ... )