lua-users home
lua-l archive

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


2013/7/25 Petite Abeille <petite.abeille@gmail.com>:
>
> On Jul 17, 2013, at 10:10 AM, David Demelier <demelier.david@gmail.com> wrote:
>
>> I just hope that one of these 2 solutions will be approved and added
>> for the final Lua 5.3
>
> What about neither?
>
> Out of curiosity… as the 46 (and counting) messages in this thread haven't made it very clear, at least to me… why do we even care if a number is an integer, float, real, double, whatnot? Isn't the purpose of that int vs. float dichotomy to be purely an implementation detail? Wholly transparent? And a number stays a number? Irrespectively of internal representation? Or?
>
> Joshua Jensen, all the way back on July 6, 2 bazillions messages ago, in reply to "[ANN] Lua 5.3.0 (work1) now available", said:
>
> "I played around with this a bit.  The only thing I found that appears to be missing is the ability to determine the actual type of the number. "
>
> To which LHF replied:
>
> "One shouldn't need to do this but you can do it as follows: … --[[ clever piece of Lua code here ]]--"
>

The first idea was to add the complement of math.isfloat so it's
easier to use without the need to remember which function is available
to know the subtype.

But then, a lot of user thought that better ideas could be used such
as __type metamethod and such.

-- 
Demelier David