lua-users home
lua-l archive

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




On 28/07/15 11:28 AM, Dirk Laurie wrote:
2015-07-28 15:26 GMT+02:00 Soni L. <fakedme@gmail.com>:
Currently these are the signatures for tostring and type:

tostring (v) -> string

type (v) -> string

Would it hurt to change them to:

tostring (v, ...) -> string, ...

type (v, ...) -> string, ...

(Similarly for math.tointeger/math.type/io.type, maybe also os.getenv, etc)
Vararging a parameter list is a breaking change, even if it is fully
backwards compatible with one-argument calls, because

     tostring(myfun(foo))

will currently keep only one of the return values of "myfun". You will
need to insert parentheses in order to preserve that behaviour.

In my reply to a previous post [1] of yours, I referred to a package
that inter alia offers item-by-item evaluation of a one-argument function
over a vararg.

[1] http://lua-users.org/lists/lua-l/2015-04/msg00225.html

Assuming my proposal goes through, print(...) -> io.write(table.concat(table.pack(tostring(...)), "\t"))

It'd be nice if we could get rid of print().

--
Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY.