> All~
>
> Perhaps I am missing something in this discussion, but wouldn't it be
> possible to have the vtable within a PMC be layered rather than the PMC
> itself.  This would allow the data portion of PMC's to remain in a fixed
>   location, while allowing new vtable layers to be pushed/popped.  If
> what I am suggesting is an entirely different beast, than I suppose I
> would appreciate an explanation of the differences.  But I would imagine
> that one could simply place a new vtable in the PMC and that vtable
> functions would have the ability to call the layer below them (possible
> after doing something like obtaining a lock).  Or they could throw an
> exception and thus prevent certain vtable slots from being accessed.

  While this solves the problem of layering the functions, just being able
to call multiple functions isn't that useful if there's nowhere to put
private data. You can't put it in the vtable, since we _really_ want those
to be shared between PMCs, and you can't put it in the PMC, since its data
space is owned by the bottom-most layer (the original, unwrapped PMC). In
perl5, this is solved by chaining MAGIC* layers, which are basically {
vtable, closure, next } triplets (although their actual structure is a bit
more complex and also has some internal bookkeeping: see perl5's mg.h at
  http://public.activestate.com/cgi-bin/perlbrowse?file=mg.h
for the details) - but, as perl5 has shown, that route leads to madness
rather quickly. As could be expected for playing with dark MAGICs. ^_^

-- BKS

Reply via email to