lua-users home
lua-l archive

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

> It's the old tradeoff — which deserves helpful behaviour more: an
> error because something that should be an integer isn't, or untidy but
> not incorrect programming?

I generally agree with that. But in the current situation, I prefer
the old behavior, for the following reasons:
 - Compatibility. I have nothing against dealing with
incompatibilities between versions if they are justified
   and well documented. It seems to me this is more a side effect.
 - Function string.format changed the way it handles %s. Previously,
only strings were accepted.
   Now every value can be accepted, since tostring() is called. The
change of %d goes in the
   exact opposite direction.
 - Lua does not have an "integer" type, only a "number" type.
Requiring an integer is therefore somewhat odd.
 - The bit32 library accepts floating point numbers as input,
converting them to unsigned integers.
   Why should the %d format behave differently ?