|
Perl 6
SMOP OO Bootstrap: Revision 2
At first, it's important to understand that all C typedef structs in So, the basic structure is:
all responder interfaces are objects
____________________________
| |
V |
SMOP__Object* SMOP__ResponderInterface*
| ^
| |
----------------------------
all objects have a responder interface
These two C types (typedef struct) are the basic elements of the SMOP Basic Idea
The Object is completely dependant on its Responder Interface, which
The only fixed thing here is that these two types must be presented Concept testing
Let's consider we have the yap6_lowlevel_responder that support the
We won't discuss namespaces here, only object references, in theory SMOP__Object* list_prototype = get_list_prototype();
Now that we have the prototype, we want to construct a new list, SMOP__ResponderInterface* list_responder = SMOP_RI(list_prototype);
The method resolution is something that depends entirely on the
SMOP__Object* capture =
SMOP_LOWL_CAPTURE(list_prototype /* invocant */,
NULL /* no positional arguments */,
NULL /* no named arguments */);
Now that we have the capture for the "new" call, we can send a
SMOP__Object* result =
SMOP_DISPATCH(
interpreter,
list_responder,
SMOP__ID__new,
arguments);
The method new, in this case would probably be the new method for
sub new ($prototype: |@_, |%_) {
my $object = $prototype.CREATE();
$prototype.bless($object, |@_, |%_);
}
And this would behave just the same. The responder would know The Bootstrap
The bootstrap would happen when the high level defines a new prototype
At this point any object+responder can be mixed together, as |