lua-users home
lua-l archive

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


Greg Falcon a écrit :
Integer division seems especially desireable because % behaves well
with integers, and it's weird to have easy access to integer remainder
but not to integer division.

I agree.

Of course applications embedding Lua can provide functions that do
these operations, but now each Lua-powered product provides a
different set of functions for doing "primitive" operations.  Maybe
that's not the worst outcome in the world; part of what makes Lua so
cool is how small it is.

That said, if stock Lua decided to add integer division, it seems
clear to me that it must add either // or \ as an operator -- these
operators are used for this purpose in other languages, and Lua has
already set a precedent here with the % operator that it should follow
for symmetry's sake.  Bitwise operations might be added as operators,
or as a family of functions in math.int, or something else.

Or in math.bit as somebody else suggested.
I agree too. On my side, I don't mind if bitwise operations are made with operators or functions. I only ask for some *official* implementation. Reuben's bitlib is OK, short, handles variable number of arguments, nice.

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --