[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Lua 5.3.0 (work1) now available
- From: David Demelier <demelier.david@...>
- Date: Thu, 11 Jul 2013 14:08:30 +0200
2013/7/10 Hisham <email@example.com>:
> -- Hisham
> On 9 July 2013 12:23, Joseph Manning <firstname.lastname@example.org> wrote:
>> On 2013-Jul-08 (Mon) at 09:01 (+0200), David Demelier wrote:
>>>> 2013/7/7 Luis Carvalho <email@example.com>:
>>>> > isinteger = function(x)
>>>> > return type(x) == "number" and not math.isfloat(x)
>>>> > end
>>>> Since this is very short, I don't see any objections about integrating
>>>> into the Lua core instead of writing it each time :-). Also there is
>>>> math.isfloat() why not math.isinteger?
>>>> Much cleaner, much convenient
>> Rather than being bloat, to me it would *enhance* the simplicity
>> of Lua to have this convenience and symmetry, rather than having
>> to remember which one of 'isfloat' / 'isinteger' comes builtin,
>> and which one needs to be derived.
> Random suggestion: how about a single function math.type() that
> returns the number subtype, "float" or "integer"?
> At the risk of over-engineering, it also occurs to me that some
> libraries may want to know whether they're running with 32 or 64 bit
> ints or floats. This function could return that info as well, perhaps
> as a second return value.
I personally like much this idea too :-)