Perl 6
Default SMOP Interpreter Implementation: Revision 7
In SLIME, every low-level opeator is actually a method call in the responder interface of the lowlevel module. For slime, the SMOP__SLIME__Operators type is actually also a responder interface that handles special methods. Calling it from the low-level works the same as calling from the high level. Every operation message is composed by basically three elements:
* responder: which responder interface handles this message
* identifier: the identifier for the message
* capture: the arguments to this message

This is valid from bottom up. This way, it's important to make available some identifiers for this operations. The only difference from the lowlevel operations to the high-level is that on the low-level the capture object must be from a known lowlevel type, so when building a lowlevel call in the high-level these specialized objects must be created and not regular capture objects.

In order to actually being able to call the operators, the low-level defines some constant objects that will later stringify to the operation name. When in the high-level using them or their stringification is valid, but using the constant values is an optimization as it will result in simple pointer comparisions instead of unicode string comparision.

The first challenge on that, is the fact that Capture is also an object, and then you might ask how as we going to create an object if we need an object to create it. And that's where a mix between frame population time and runtime comes to rescue.

Let's consider you want to build a frame in the runtime, then you'll need to capture the parameters to the frame operations. You do that by knowing the frame you are creating, and then moving things in the frame to make them available to other calls. As the knowledge of what to move, from where and to where is already available when you are building the frame you'll invoke, you can use at that time some specific objects and build the frame. This specifc objects don't use the SMOP frame, only the C stack which makes you free to call them anytime, by using the lowlevel C subroutine, while the prototype will still support a high-level call that builds the same object.

The SMOP__SLIME__Stack and the SMOP__SLIME__Node prototypes are the ones used to create new stacks and to operate on it. Differently from the lowlevel stack operations that manipulate the currently running stack, these methods are safe to be run without a current stack at all. This methods always look for the stack as the invocant in the capture, and not as the stack parameter to the lowlevel MESSAGE call. In fact, when calling the low-level MESSAGE (using SMOP_DISPATCH, probably) you can even pass NULL as the current stack. IF this methods need to recurse they will do it using the C stack. The only exception for this rule is the "eval" method on the Stack prototype. This method will actually call a message using the given stack as the call stack, and probably cause stack manipulation. The methods of this types already use a high-level compatible Capture (as opposed to the lowlevel stack operators that use a different object as the capture), but still some helper C methods are defined here to create the captures, as to make it possible to use these methods from the low-level more easily and efficiently. As with the lowlevel operators, a set of constants is defined as to provide a more optimized method for name resolution for this prototypes. But if that fails, it will fallback to string name resolution.

^ SMOP__SLIME__Frame

The Frame prototype defines the implementation in itself, it's the one with the "eval" method. It has the following members.

* lexical
* back
* nodes
* pc -- program counter

And the following methods:

* new(SMOP__SLIME__Frame: *@nodes) -- creates a new frame object defining the nodes.
* next($frame: ) -- goes to the next node in the stack, possibly drop frames.
* goto($frame: $node) -- sets the node as the currently selected node.
* eval($frame: ) -- evaluates the currently selected node and stores the result in the result field of the node.
* result($frame: $count) -- gets the result of the past node that is $count away from the current node.
* has_next($frame: ) -- returns true if there's any more node to eval.
* setr($frame: $value) -- sets the result of the current node to the given value.
* drop($frame: ) -- implements return-like semantics, calling setr last return and goto back.
* push($frame: ) -- implements subroutine-call-like semantics passing the current capture as the result of the first node.

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.