On May 8, 2007, at 6:02 PM, Alek Storm wrote:
On 5/8/07, chromatic <[EMAIL PROTECTED]> wrote:
With :vtable, you define a sub of the appropriate name and use
the :vtable
attribute.
Without :vtable, you define a sub of any name, add :anon so as not to
pollute
your namespace, somehow magically get that sub in a PMC, get the
appropriate
class in a PMC, and then call add_method on that class object with
the sub
object, being sure to do all of this at load or instantiation time
so that
people can use the right vtable entry any time during the program.
No, with :vtable you define a sub of any name and use the :vtable
attribute,
specifying which vtable method it overrides if the name doesn't
match the
vtable name. Then you create a Class PMC and call 'add_method' on it,
passing the name, sub, flag that it's a vtable method, and flag
that it's
anonymous. However, since it's anonymous, the name parameter doesn't
matter.
Without :vtable, you define a sub of any name. Then you create a
Class PMC
and call 'add_vtable_method' on it, passing the vtable name and sub.
Remember that this patch is for PDD15, not the old object system.
Even so,
classes are *already* manually created at load time in both the
PDD15 and
old object systems - that's where we stick the 'newclass' opcode.
Looking at PDD15, I see this paragraph...
> To override a vtable function, either add the :vtable pragma to the
> declaration of the method, or pass a named parameter "vtable" into
the
> add_method method on a class or role.
... which is kind of lonely, since, as you point out, there is no way
in PDD15 to *declare* a method (and not that vtable ISA method, either.)
If we're keeping :vtable, we need to update this verbiage (and
include an example) to avoid confusion.
On a related note, :method is mentioned in docs/compiler_faq.pod &
docs/imcc/calling_conventions.pod. If it's dead, it needs to be
deprecated; if it's not, it should probably be mentioned in PDD15.
--
Alek Storm
--
Will "Coke" Coleda
[EMAIL PROTECTED]