|
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 contributingFor 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
Philipp