[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: __eq in shared metatables
- From: Luis Carvalho <carvalho@...>
- Date: Fri, 10 Aug 2007 16:38:08 -0400
> > Is there any reason why __eq is not called when the metatable is shared for a
> > type other than table and userdata?
> > [...]
> > > print(3==4)
> > false
> Isn't this reason enough?
Not for me (not that I would define __eq for numbers; this is just an
example). What about functions? I can understand why you don't have individual
metatables for functions, but why not __eq? From the point of view of
"providing mechanisms, not policies", it seems weird to decide for the user if
he should or not define __eq for a certain type.
Anyway, I just think that if this is a reason for the authors, it should be at
least stated in the manual. And, as I said, since we were talking about __len
being honored for tables, I'm all for __eq (and other comparisons for that
matter) being more "consistent".
A mathematician is a device for turning coffee into theorems.
-- P. Erdos
Applied Math PhD Student - Brown University
PGP Key: E820854A <email@example.com>