lua-users home
lua-l archive

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


On Thu, Sep 11, 2008 at 1:35 PM, Rob Hoelz <rob@hoelzro.net> wrote:
....snip...
> Method lookup with metatables is fast enough; that's
> not what I'm memoizing.  I want to write a multimethod system (akin to
> CLOS or Dylan) on top of my object system that my object system can use,
> but doesn't have to.  In order to do that efficiently, I need to memoize
> which methods correspond to which combinations of objects.  Here's an
> example:

ah, ok.  yep, that's a neat feature (iff you like inheritance ;-) i've
seen it in Dylan but didn't know it was called 'multimethod'.

what i would do is similar: create a key string that embodies the
types of all objects involved.  specifically, i would use
tostring(getmetatable(obj)) for each parameter and concatenate those.


-- 
Javier