prototype multiple dispatch creates uncollectable garbage?

James McCartney asynth at io.com
Fri Sep 3 12:02:15 PDT 2004


On Sep 3, 2004, at 11:34 AM, Brian T. Rice wrote:

> Probably the solution will have to involve a type of system-update 
> notification system, kind of a feature which could be applied to have 
> the effect of finalizers, as an example. Basically we'd need to 
> trigger events when an object's map's roles are removed or otherwise 
> invalidated. The problem is then that the system has to correctly 
> identify which signature applies to the method. In general, method 
> removal is tricky because there may be derived maps and so forth which 
> also have the same signature. So there is a deficiency or gap in the 
> things that the naive PMD configuration, but we're working on it. One 
> factor that allows us not to address it is that our images can be 
> built up rather easily, so we haven't been too concerned with removal 
> yet.
>

The solution that came to my mind was storing the methods and their 
roles only in the first argument. This seems assymmetrical from a 
storage point of view, but it is still equivalent from the point of 
view of dispatch. Once you know the set of methods applicable to the 
first argument, the methods applicable to all arguments can only be a 
subset of this. So you can just search the parents of the other 
arguments to see if they occur in the method roles. In other words, the 
roles point to the objects instead of the objects pointing to the 
roles. This means that if the first argument becomes collectable, all 
of its methods become collectable, even those that specialize on 
permanent objects. The other benefit of this is that objects like true, 
false don't get junked up with lots of methods that they play lesser 
roles in.

-- 
--- james mccartney




More information about the Slate mailing list