  lua-l archive

• Subject: Re: boolean operators
• From: Glenn Maynard <glenn@...>
• Date: Thu, 28 Sep 2006 17:27:21 -0400

On Thu, Sep 28, 2006 at 03:19:37PM -0500, Rici Lake wrote:
> >Integers are bit masks; bit masks are as much fundamental types in
> >Lua as integers, by this logic.  Also, % is floating point modulus;
> >looking at a particular subset of its uses (integer remainder) and
>
> Integers can be represented as bit strings, certainly, but then so can

I was speaking the other way around: floats represent integers, and
integers represent bit strings; if that means integers are a fundamental
type, bit strings are too.  They both seem equally contrived.

> >wanting a paired operator with that seems like rationalizing a sqrt()
> >operator because a subset of multiplication is squaring.
>
> Sqrt is a specialization of ^, not a subset of it. I'm not arguing
> either way about a sqrt unary operator, although it would be a
> plausible way of speeding up calculation of square roots in hard loops.

Not what I meant.  Squaring (m^2) is a subset of multiplication (m*n
where m == n), just like remainder is a subset of modulus (m % n where
m and n are integers).  Saying "remainder is built into the language,
so integer division should be too" is like saying "squaring is built
into the language, so square root should be too".

--
Glenn Maynard