Perl 6
SMOP p6opaque Implementation: Revision 7

The p6opaque Responder Interface is the default responder for all Perl 6 objects.

Basics

This is a prototype-based OO system. It means that a class is simply an undefined object. The following assumptions help to understand it:

  • $object.WHAT() === $prototype
  • $prototype.WHAT() === $prototype
  • $object.HOW() === $prototype.HOW()
  • $object.clone.WHAT() === $object.WHAT()
  • $object.clone.HOW() === $object.HOW()
  • $prototype.clone.HOW() !=== $prototype.HOW()

This stablishes the following relationships:

  • Every object have a prototype
  • Every object is defined
  • Every prototype is undefined
  • A prototype is its own prototype
  • Every prototype have its own metaclass instance
  • When cloning an object, the prototype information is cloned, therefore it points to the same prototype.
  • When cloning a prototype, the metaclass information is cloned and it becomes a new prototype, therefore it has a different metaclass instance.

Implementation

  • Both the prototype and the object are objects
  • An object is composed by slots
  • the slots in the object store what is described by the prototype
  • the slots in the prototype describes the prototype

Composition

This is a hard topic in Perl 6, as compositions are mostly unpredictable (unless the class is closed). This way the composition is made with a "composition pile", where every composition operation is put in order, allowing correct method resolution. But the declarations in a class always override any composition declaration. That way, a prototype have:

  • The composition pile (in order of composition)
    • At compile time the order is:
      • inheritance (reverse of the specified order)
      • roles (in no particular order)
    • At runtime the order is
      • when composing with "is", it unshifts the pile
      • when composing with "does", it pushes the pile
  • The methods

So the lookup always:

  • Looks for a member of the class
  • goes bottom-up in the "composition pile" looking for the member

An object, on the other hand, have only:

  • Prototype reference
  • Storage space for each participant of the composition (including the class itself), where each participant only sees its own space.
    • each space contain slots for the attributes defined by that participant.

Upload Files

Click "Browse" to find the file you want to upload. When you click "Upload file" your file will be uploaded and added to the list of attachments for this page.

Maximum file size: 50MB

 
 
 
File Name Author Date Uploaded Size

Save Page As

Enter a meaningful and distinctive title for your page.

Page Title:

Tip: You'll be able to find this page later by using the title you choose.

Page Already Exists

There is already a page named XXX. Would you like to:

Save with a different name:

Save the page with the name "XXX"

Append your text to the bottom of the existing page named: "XXX"

Upload Files

Click "Browse" to find the file you want to upload. When you click "Add file" this file will be added to the list of attachments for this page, and uploaded when you save the page.

 
 
 
Add Tags

Enter a tag and click "Add tag". The tag will be saved when you save the page.

Tag: 

Suggestions: