|
Perl 6
SMOP OO API: Revision 3
In order to ensure the interoperability among object representations and even between different object systems that uses the same representation. In this context we need to define the HOW and REPR API, this is the SMOP OO API that allows representations to be interchanged, and custom BUILD methods to be written. Object APIThis is what is implemented by Object
method new($prototype: *@protoobjects, *%initialize) {...};
method bless($prototype: $candidate?, *@protoobjects, *%initialize) {...};
submethod CREATE($prototype: :$repr) {...};
submethod BUILDALL($object: *@protoobjects, *%initialize) {...};
submethod BUILD($object: *@protoobjects, *%initialize) {...};
HOW APIThis is the instrospection API, that is available as standard Perl 6 and modify the current object.
method ^methods($object: ) {...};
method ^add_method($object: $name, $method) {...};
method ^add_isa($object: $superclass) {...};
method ^add_role($object: $role) {...};
REPR APIThis is SMOP specific, and it isn't part of the standard Perl 6, however, this is how different representations can coexist in SMOP. This only operates in the specific object, it doesn't look to any of the superclasses, that might even have a different representation.
sub CREATE() {...};
sub bless($object, $direct_prototype) {...};
sub add_isa($object, $new_superclass) {...};
sub del_isa($object, $unwanted_superclass) {...};
sub add_role($object, $new_role) {...};
sub del_role($object, $unwanted_role) {...};
sub add_private_storage($object, $prototype, $name, $container) {...};
sub get_private_storage($object, $prototype, $name) {...};
sub del_private_storage($object, $prototype) {...};
sub add_class_storage($prototype, $name, $container) {...};
sub get_class_storage($prototype, $name) {...};
sub del_class_storage($prototype, $name) {...};
sub add_method_definition($object, $name, $method) {...};
sub get_method_definition($object, $name) {...};
sub del_method_definition($object, $name) {...};
sub add_attribute_definition($prototype, $name, $signature) {...};
sub get_attribute_definition($prototype, $name) {...};
sub del_attribute_definition($prototype, $name) {...};
|