|
Perl 6
SMOP OO API: Revision 2
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. 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.
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 add_class_storage($prototype, $name, $container) {...};
sub get_class_storage($prototype, $name) {...};
sub add_method($object, $name, $method) {...};
sub get_method($object, $name) {...};
|