lua-users home
lua-l archive

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


On Thu, Sep 28, 2006 at 04:18:04PM -0400, Greg Falcon wrote:
> On 9/28/06, Glenn Maynard <glenn@zewt.org> wrote:
> >On Wed, Sep 27, 2006 at 10:50:27PM -0500, Rici Lake wrote:
> >> It is sometimes useful to do integer arithemetic; a useful subset of
> >> Lua numbers are integers. A number of interesting algorithms involve
> >> integer arithmetic.
> >
> >Integers are bit masks; bit masks are as much fundamental types in
> >Lua as integers, by this logic.
> 
> This argument ignores the fact that Lua does indeed treat integers
> specially.  This even goes beyond implementation details.  One
> user-visible way is that the semantics of operator # are defined based
> on integers.
> 
> So we've got operator # that relies on integers, operator % with is
> particularly well suited to dealing with integers.  Certainly it's a
> reasonable assertion that integers have a role to play in Lua, and I
> propose it's not wildly out-of-line to request an operator that is the
> natural compliment to %.

I think it's out-of-line to request an operator *based* on the logic
"we have this, so we should have this too".  That's bloat for the sake
of bloat.  If there are better reasons for it, they can be given (and
they have, though I happen to disagree with them).  If there aren't,
it shouldn't be added.

(Even if Lua had a native integer type--and I hope something like the
integer patch will make it into the core some day--I still think the
notion of having two division operators in a language proclaiming its
simplicity is nuts.)

-- 
Glenn Maynard