Chromatic <[EMAIL PROTECTED]> wrote:
> According to PDD15, defining a method called __find_method() in my PASM
> or PIR would allow Perl 5 AUTOLOAD-like behavior.

That's a cut'n'paste error in pdd15 - at least now. All vtable methods,
which are explicitely in ParrotClass/ParrotObject aren't overridable.
You might have a look at classes/parrotobject.c:

        ...
        Parrot_delegate_clone,
        Parrot_ParrotObject_find_method,
        Parrot_delegate_get_integer,
        Parrot_delegate_get_integer_keyed,
        ...

But there will be of course some AUTOLOAD scheme. And you can simulate
one with exceptions:

  .sub _main
      $P0 = newclass "A"
      $I0 = find_type "A"
      .local pmc obj
      obj = new $I0
      .local pmc exh
      newsub exh, .Exception_Handler, _exh
      set_eh exh
      obj."meth"(42)
      print "done\n"
      end
  .end

  .sub _exh
      print "exh\n"
      print "exh - wanted '"
      print S0
      print "'\n"
      $P0 = find_global "A", "__f42"
      invoke $P0
  .end

  .namespace ["A"]

  .sub __f42 method
      print "42\n"
  .end

$ parrot o.imc
exh - wanted 'meth'
42
done

leo

Reply via email to