lua-users home
lua-l archive

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


KHMan <keinhong@gmail.com> wrote:

> I have no problem with a diversity of views. All you need to do now is to
> convince Roberto that he needs the patch... :-)
> 
> As for myself, I will take note of whatever the eventual outcome and get
> on with coding. My brain is already primed to sound klaxons on seeing
> math.huge. Keeping 2s complement arithmetic in looping and its flaw(s)
> isn't perfect but it's a known quantity. Patching the looping code would
> make it "2s complement but not quite 2s complement". Either way, I hope we
> can have some updates to the section on numerical loops in the reference
> manual.

I have no problem with diversity of views, I just don't understand your
position on this issue... the math is still all the same, just the logic
about when to add/sub the step value has changed, so your comment about 2s
complement is confusing to me. Also, just because C also would have the same
overflow problem doesn't mean that the issue has to exist in Lua as well,
especially when the fix is a very simple change with negligible impact.

As a scripting language I would expect some error or edge case handling to
be present. When looping from a start to end value I would expect that to
work correctly without the need to test and write special code to handle
using min/max integer values in loops! :)

~Paige

PS: I assume you are the same KHMan who wrote that guide to Lua 5.1 opcodes
a number of years ago? If so, thank you, that was immensely useful to me!