lua-users home
lua-l archive

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

Cant say I disagree, but the same could be said of __tostring(), yet we have that. Of course two wrongs don't make a right, but I still think it's an asymmetry in the design.

On Jul 5, 2013, at 10:22 PM, Miles Bader <> wrote:

> 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
> follow.
> 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.
> -miles
> -- 
> "... The revolution will be no re-run brothers; The revolution will be live."