lua-users home
lua-l archive

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


> The point of my original post was that the sub-types of “number" in
> Lua 5.3 make the number type more complex than before, and that it
> *might* actually be simpler to not try to hide the sub-types inside
> number but to simply have two different types. I didn’t say it
> should be done, i was just speculating. However, I don’t see how you
> could explain my earlier example without going into the details of
> integers vs floating point, so in a way there ARE two types; they are
> just hidden within the “number” type. After all, this will require
> some explaining as well:

There ARE two subtypes, nobody is trying to hide that. They are
"grouped" inside "number", not hidden. The manual says there are two
subtypes, there are functions to distinguish them, and their values are
even printed differently.

The difference between two types and two subtypes boils down to what is
the value of "type(1) == type(1.0)". Making them different (that is, two
full types) would break a lot of code, with little gain (if any, in my
point of view).

-- Roberto