lua-users home
lua-l archive

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

Old code would not break.

Have the __typeof metamethod return two values.  The first is "userdata" and the second whatever specific type you like.  That way old code doesn't break, and new code could check first whether the variable is userdata and then what specific type of userdata.

On Tue, 2006-01-17 at 12:25 -0200, Alex Queiroz wrote:

On 17/01/06, Lisa Parratt <> wrote:
> So because someone might cut their fingers off, we shouldn't use knives?
> Just because someone might burn themselves, we shouldn't cook food?

     Please stop trying to be Lao-Tze.

> Just because a facility has consequences that may be problematical is no
> reason to utterly dismiss the facility.

     Luiz is talking about all the old code that would break with this
new type function. Unfortunately people can't see the future yet, so
as to avoid burning themselves.