Phil Hagelberg <phil@hagelb.org> writes:
The suggested patch makes the behavior consistent with Lua, in that
numbers are converted to strings, from 1 to any number of arguments, and
also consistent with Lisp, where 0 arguments result in returning the
identity value.
So, we have:
(..) -> "" -> correct in Lisp
(.. "1") -> "1" -> correct in Lisp
(.. "1" "2") -> "12" -> correct in Lisp and Lua
(.. 1) -> "1" -> correct in Lisp with Lua coercion
(.. 1 2) -> "12" -> correct in Lisp with Lua coercion
All this is correct and expected in a Lisp dialect that obeys Lua type
coercion rules.
The patch breaks e.g. concatenating a table with itself, but such an
operation, let alone its return value, does not make any sense.
Rud
I feel that this change may imply that .. performs a coersion to string,
which it doesn't, and we'll get bug reports like why (.. some-val)
errors with 'runtime error: attempt to concatenate a table value'. Maybe
it would be better to require at least two arguments for .. same as we
have for comparison ops?