lua-users home
lua-l archive

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


On Mon, Nov 18, 2013 at 8:20 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> With the aid of debug.setmetatable it is possible to define
> expressions involving functions.

I briefly got very excited about the possibilities of doing this, and
in fact seq.import in PL makes all functions accept seq 'methods'.
When first experimenting with Microlight I found that composition and
binding could be very elegantly expressed in the way you describe
(which feels less ad-hoc than the seq hack).  However, it _is_ a
global hack.

Now, if the shared metatable of functions was relative to _ENV, then
we could have the situation that a person could organize things to
their satisfaction within their modules, without trampling on the
design space of other modules.