[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Numbers in Lua 5.3work
- From: Mike Nelson <mikestar1313@...>
- Date: Tue, 24 Jun 2014 15:18:41 -0700
All the discussion about integers really has me wondering how this is
all going to work. I feel that there is the potential for a lot of nasty
surprises at the new behaviour of integers and floats silently
interconverting. I can see how a distinct integer type would work: think
C. The integer subtype leaves me feeling uneasy. This is not a problem
for my current use cases: I can stick with Lua 5.2 and its all number
are floats (actually doubles in the default configuration) model, the
same number model that has been used from the beginning. For use cases
where I would need to work in integer but could dispense with floats, I
can compile 5.2 with int or long as the number type. Where 5.3 would be
useful is when I would need actual integers but couldn't dispense with
floats--but in that case, explicit integer and float types would work as
well as subtypes, with fewer surprises. Yet a full integer/float type
system would break too much existing code. I don't envy the Lua team
here--it's very debatable which is the best way to go.
Other features of 5.3work are quite good: The utf8 library is so good
that I have backported it to Lua 5.2; and while my current use cases are
not helped by moving bit operations into the core, it causes me no
problems and is quite useful for those who use bit operations frequently.
-- Mike Nelson