20 Aug 2010 00:48:58 UTC
- Development release
- Distribution: KinoSearch
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (5)
- Testers (62 / 24 / 1)
- KwaliteeBus factor: 0
- License: perl_5
- Activity24 month
- Download (889.34KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionCREAMYG Marvin Humphreyand 1 contributors
- Marvin Humphrey <marvin at rectangular dot com>
- COPYRIGHT AND LICENSE
Clownfish::Method - Metadata describing an instance method.
Clownfish::Method is a specialized subclass of Clownfish::Function, with the first argument required to be an Obj.
When compiling Clownfish code to C, Method objects generate all the code that Function objects do, but also create symbols for indirect invocation via VTable.
my $type = Clownfish::Method->new( parcel => 'Crustacean', # default: special class_name => 'Crustacean::Lobster::LobsterClaw', # required class_cnick => 'LobClaw', # default: special macro_sym => 'Pinch', # required return_type => $void_type, # required param_list => $param_list, # required exposure => undef, # default: 'parcel' docucomment => $docucomment, # default: undef abstract => undef, # default: undef final => 1, # default: undef );
param_list - A Clownfish::ParamList. The first element must be an object of the class identified by
macro_sym - The mixed case name which will be used when invoking the method.
abstract - Indicate whether the method is abstract.
final - Indicate whether the method is final.
parcel, class_name, class_cnick, return_type, docucomment, - see Clownfish::Function.
Returns true if the method's class is the first in the inheritance hierarchy in which the method was declared -- i.e. the method is neither inherited nor overridden.
Return the Clownfish::Type for
# e.g. "LobClaw_Pinch" my $short_sym = $method->short_method_sym("LobClaw");
Returns the symbol used to invoke the method (minus the parcel Prefix).
# e.g. "Crust_LobClaw_Pinch" my $full_sym = $method->full_method_sym("LobClaw");
Returns the fully-qualified symbol used to invoke the method.
# e.g. "Crust_LobClaw_Pinch_OFFSET" my $offset_sym = $method->full_offset_sym("LobClaw");
Returns the fully qualified name of the variable which stores the method's vtable offset.
# e.g. "crust_LobClaw_pinch_CALLBACK" my $callback_sym = $method->full_calback_sym("LobClaw");
Returns the fully qualified name of the variable which stores the method's Callback object.
# e.g. "crust_LobClaw_pinch_OVERRIDE" my $override_func_sym = $method->full_override_sym("LobClaw");
Returns the fully qualified name of the function which implements the callback to the host in the event that a host method has been defined which overrides this method.
# e.g. "Claw_pinch_t" my $short_typedef = $method->short_typedef;
Returns the typedef symbol for this method, which is derived from the class nick of the first class in which the method was declared.
# e.g. "crust_Claw_pinch_t" my $full_typedef = $method->full_typedef;
Returns the fully-qualified typedef symbol including parcel prefix.
Let the Method know that it is overriding a method which was defined in a parent class, and verify that the override is valid.
All methods start out believing that they are "novel", because we don't know about inheritance until we build the hierarchy after all files have been parsed. override() is a way of going back and relabeling a method as overridden when new information has become available: in this case, that a parent class has defined a method with the same name.
my $final_method = $method->finalize;
As with override, above, this is for going back and changing the nature of a Method after new information has become available -- typically, when we discover that the method has been inherited by a "final" class.
However, we don't modify the original Method as with override(). Inherited Method objects are shared between parent and child classes; if a shared Method object were to become final, it would interfere with its own inheritance. So, we make a copy, slightly modified to indicate that it is "final".
confess("Can't override") unless $method->compatible($other);
Returns true if the methods have signatures and attributes which allow one to override the other.
Copyright 2006-2010 Marvin Humphrey
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.