[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: First class : (was Re: Regarding the name 'pairs')
- From: Mark Hamburg <mark@...>
- Date: Mon, 14 Sep 2009 23:13:04 -0700
Of course, this all leads to the ulterior motive of making obj:method
(...) more than just sugar for obj.method( obj, ... ).
The semantics of how to do that remain fuzzy and depend to some extent
on the goals.
The simplest option is introducing a separate metatable entry which
parallels __index but which will be used in preference to __index when
doing method lookup. This alone makes it easier to implement
properties/attributes on objects and catches many accidental uses of
period rather than colon. But that then leads to questions such as
whether there needs to be a corresponding method assignment metamethod
and just how much complexity is warranted.