|
On 3-Aug-05, at 5:22 PM, Mark Hamburg wrote:
Not that anyone probably wants to change 5.1 at this point, but maybe theanswer to these issues is a way to override OP_SELF to better work withbasic types. That way, one could define default implementations for thingslike: t:insert s:len t:len
That seems counter to the behaviour of metamethods on other operators. Or would you also suggest that a[x] be changed to rawget(a, x) and metauses rewritten as a:get(x)? And, by the same token, a:plus(b) to get the metamethodical '+'? I think the syntactic beauty of metamethods is precisely that they are easy to write.
It's not clear to me how OP_SELF could work with the table basic type, in any event, unless it were redefined to only look in the metatable. Otherwise, it would limit the keys you could place in a table (viz. javascript irritations).
R