Further to the lightweight proxy thing, one of the things that proves
to be something of a pain in Pixie is writing 'self replacing'
proxies, where, once something is actually fetched from the database,
the proxy should go away. You can't simply assign to $_[0] (at least
in Perl 5) because that doesn't change every container that contains a
reference to the proxy. Right now, we do it with evilness like 

    %{$self} = %{$the_real_object}

which, whilst it fixes the "Doesn't change everywhere" issue, can
cause problems when classes track their instances.

So, the question is, if I do:

    class Proxy {
       ...

      method AUTOLOAD($methodspec) {
        $_ := .get_the_real_thing;
        .DISPATCH($methodspec); # Or whatever restarts the dispatch sequence
      }

(Where C<$methodspec> is a handwavy object that encapsulates all the
information that Perl collects for dispatch purposes, hopefully
including at least context, methodname and parameters).

Will the proxy replace itself everywhere at a stroke, or will it do
the replacements piecemeal, replacing each reference to the proxy as
it tries to invoke a method on it?
    
-- 
Piers

Reply via email to