[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.3 work1 Considering math.isinteger or type()
- From: David Demelier <demelier.david@...>
- Date: Mon, 22 Jul 2013 09:04:59 +0200
2013/7/19 Philipp Janda <siffiejoe@gmx.net>:
> Am 19.07.2013 10:00 schröbte Pierre Chapuis:
>
>>> Well, my suggestion of sticking debug.subtype() inside type() was
>>> meant to sidestep the issue of where to put it, while keeping the API
>>> function count low. I'm not strongly advocating it, just contributing
>>
>>
>> For what it's worth, I agree with that idea.
>> I really don't like the idea of putting subtype() in debug.
>
>
> I'm fine with `debug.subtype`, although I probably would call it
> `debug.type`, just like `debug.setmetatable` provides a superset of
> functionality compared to plain `setmetatable`.
>
> But do we need that function at all? Are there any use cases where you want
> to know the actual subtype of functions or userdata in Lua code, or is this
> just for the sake of completeness?
>
> At the moment, my preferred solution would be math.type (like io.type,
> lpeg.type, etc.):
> * no new global variables
> * no new names
> * no unfamiliar calling conventions
> * if people remove debug functions, they probably won't make an exception
> for harmless functions like (sub)type
> * the only reason to remove `math` is if you don't have floats in which
> case this function becomes obsolete anyway
>
Yes, math.type looks absolutely the best solution!
Regards,
--
Demelier David
- References:
- Lua 5.3 work1 Considering math.isinteger or type(), David Demelier
- Re: Lua 5.3 work1 Considering math.isinteger or type(), steve donovan
- Re: Lua 5.3 work1 Considering math.isinteger or type(), Roberto Ierusalimschy
- Re: Lua 5.3 work1 Considering math.isinteger or type(), Fidelis Assis
- Re: Lua 5.3 work1 Considering math.isinteger or type(), Roberto Ierusalimschy
- Re: Lua 5.3 work1 Considering math.isinteger or type(), Hisham
- Re: Lua 5.3 work1 Considering math.isinteger or type(), Andrew Starks
- Re: Lua 5.3 work1 Considering math.isinteger or type(), Hisham
- Re: Lua 5.3 work1 Considering math.isinteger or type(), Andrew Starks
- Re: Lua 5.3 work1 Considering math.isinteger or type(), Hisham
- Re: Lua 5.3 work1 Considering math.isinteger or type(), Pierre Chapuis
- Re: Lua 5.3 work1 Considering math.isinteger or type(), Philipp Janda