[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: 5.1
- From: Rici Lake <lua@...>
- Date: Mon, 17 Oct 2005 23:42:01 -0500
On 17-Oct-05, at 10:20 PM, Glenn Maynard wrote:
The case I was thinking of is
function f(it) for x,y in it do print(x) end end
t = { 1, 2, 3 }
f( pairs(t) )
function f(...) for x,y in ... do print(x) end end
t = { 1, 2, 3 }
f( pairs(t) )
I
keep finding Lua's multiple-results unintuitive and rather forced
compared
to the rest of the language; I guess I'll get used to them eventually.
There's no problem with multiple-results here; you simply haven't
provide for multiple arguments.
Clearly, run-time warnings are a non-starter. At run-time, you either
get an error or a strange result or it works. (In the case of the C
problem, writing = for ==, you tend to get strange results.)
The algorithm I outlined for compile-time warnings would have correctly
flagged that case, although it wouldn't have provided the correct
solution.