lua-users home
lua-l archive

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


starwing <weasley.wx@gmail.com> writes:
> now we changed the standard library in Lua 5.2(the set/getfenv
> are deprecated. so change the ... semantics is not a unacceptable change in
> new version of lua. if we makes f() return its all return value in all
> situation, and  (f()) just return its first return value, we will get
> the consistency behavior then we process return value. I think thus is
> important than portability.

It's not as simple as you imply.

There's a very good reason that only one return value from "f" is used
in the following case:  g (x, y, f(), p, q) -- it's predictable.

For table constructors, e.g. {x, y, f(), p, q}, perhaps it would be less
of an issue, as tables are often treated as simple sequences where
precise position is less important.  However I think it's arguable that
for consistency with the function-argument case, MRV in
table-constructors should be treated the same.

Since a new explicit syntax (e.g., {x,y,f()...,p,q}) resolves the above
issues, and avoids incompatibility with existing code, it's preferable
to changing the meaning of the existing syntax.

-Miles

-- 
Admiration, n. Our polite recognition of another's resemblance to ourselves.