lua-users home
lua-l archive

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


On 13-6-2012 19:38, Roberto Ierusalimschy wrote:
What precisely are we talking about?

(1)  1 + "2"  (- * / etc)

(2)  1 .. "2"

(3)  concat({1,"2"})

(4)  format("%s",1)

I suppose only in the first case automatic conversion is unwanted?
Actually I can imagine that a future concat does a tostring if
needed so that { 1, "2", true } also works.

I am talking mostly about (1). (2) could be kept, but probably
implemented through some metamethod by the standard library.
(3), (4), and others could be handled on an individual basis. (For
instance, does anyone need string.gsub(10000, 0, 1)?)

I don't think so (or at least not deliberately) so indeed such conversion cases can go as well. (To be honest, I wasn't even aware of it being accepted so I never tried something like that.)

Concerning (2): not all types have metatables so boolean is still somewhat of a problem then. (I can live with it.)

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
    tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------