lua-users home
lua-l archive

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


On Mon, Oct 17, 2005 at 11:42:01PM -0500, Rici Lake wrote:
>   function f(...) for x,y in ... do print(x) end end
>   t = { 1, 2, 3 }
>   f( pairs(t) )

(I pruned the fixed version from my reply for brevity, but if people
really needed it, there they go.  :)

> There's no problem with multiple-results here; you simply haven't 
> provide for multiple arguments.

The problem is that design of the language, in this area, is unintuitive
and unnatural to me.  The multiple-results documentation in PiL reads like
a checklist of special cases to be memorized.  I'm not saying it's something
that should or could be changed; it just feels forced.

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

It's a reasonable approach, just not a good one for Lua's minimalistic
design, especially if it could be done at compile time instead.  In any
case, I hope that if language features are deprecated in the future,
something better than an obscure documentation note might be found.

-- 
Glenn Maynard