[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (rc3) now available
- From: Patrick Rapin <toupie300@...>
- Date: Wed, 30 Nov 2011 13:39:55 +0100
> 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 ?