Closed ghost closed 9 years ago
I'm not currently planning to support a separate integer type. I chose doubles deliberately over floats because they have enough room in the mantissa for integers large enough for almost all normal purposes. Not having a separate integer type makes the implementation simpler and faster and also makes the overall system, I think, easier to reason about.
I should write this up in detail somewhere, but the basic idea is:
insert()
on lists, etc.) causes a runtime error if a floating point value is passed.~
, ^
, |
) explicitly act on unsigned 32-bit values and give 32-bit unsigned results.The main missing piece is an integer division operator.
I admit having only doubles isn't a perfect solution, but I think it works tolerably well for most cases and the simplicity and performance benefits they deliver are pretty significant.
I'm lacking the expertise to really to have a well balanced opinion, but your answer seems to make sense and Lua seems to target mostly embedded systems and comfortable developers with the extra integer.
The main missing piece is an integer division operator.
What about a general truncation operator instead?
What about a general truncation operator instead?
We definitely want that too, but I find it's tedious to rely on that when you want integer division semantics. You get tired of (a / b).truncate
all over the place.
Well, that looks reasonable. Thanks.
By the way, I'm working on the math operators such as truncate. Will send the push request in the next days.
Sounds good, thanks!
Hi, Lua developers recently added integer value types to their language.
Would they make sense in Wren as well? Are they nice to have in game scripting languages? Or were they added to Lua for clearly other purposes?