lua-users home
lua-l archive

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

Tim Hill <> writes:
> I suggested __type() as an extension to type() some time ago, for
> other reasons. In fact, it's an odd omission (to my mind), given
> that we have __tostring() and others.

This has been extensively discussed on this list... one issue is that
it's not entirely clear that "type()" is really a very good example to

I think typically when somebody queries the "type" of an object, what
they _really_ want to know is "does this object conform to interface
X" (e.g. a "table" allows lookups etc, a "function" can be called,
etc), and it's not unusual for something to actually conform to
_multiple_ interfaces (e.g. a table with __call)...  So something that
returns only a single value like type() can be awkward/clumsy.


"... The revolution will be no re-run brothers; The revolution will be live."