[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Memoizing functions with multiple inputs
- From: "Javier Guerra" <javier@...>
- Date: Thu, 11 Sep 2008 13:06:44 -0500
On Thu, Sep 11, 2008 at 12:44 PM, Rob Hoelz <firstname.lastname@example.org> wrote:
> Hello everyone,
> I'm trying to write a multiple dispatch method system for Lua using my
> object system, of which the cornerstone is this:
> Using a tree-like memoization cache is fairly clear, but I have the
> feeling that there's a better way to do this. Any hints/suggestions?
to use multiple inputs as key to the memoization table, you can either
nest tables (what you call tree-like), or join all inputs into a
single string and use that as key.
but, i don't really get your object implementation, and it seems you
want to use memoization to speed up method lookup. if so, you should
really rethink your object infrastructure. if lookup is so expensive,
it might be better to copy all inherited methods in the new class
of course, i find myself caring less and less about class-based OOP.
i especially don't find the inheritance concept worth in real life the
troubles it carries.