lua-users home
lua-l archive

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

On Wed, Sep 27, 2006 at 10:52:35AM -0500, Rici Lake wrote:
> Clarity of expression, really. I personally could live without bitwise
> operators, or table append syntax.
> Now, it's true that you can define a // b as math.floor(a / b), but then
> you could define a % b as a - b * math.floor(a / b), but I'd argue that
> in both cases, the operator is a clearer statement of intent.

I'd define a // b and a % b as math.idiv(a, b) and math.irem(a, b).  If
the former are clearer, I think the difference is marginal.  It seems
a small difference for the cost of complicating the core language.
(I think one of Lua's virtues is not stuffing too much into its core,
so adding operators feels like a big cost.)

Glenn Maynard