org.erights.e.elib.base
Interface Script

All Known Implementing Classes:
CallableScript, JavaMatcher, Matcher, MethodNode, VTable

public interface Script

Untamed:


Method Summary
 Object execute(Object self, String verb, Object[] args)
          Enabled: verb must be an interned string
 void protocol(Object optSelf, FlexList mTypes)
          Enabled: Adds to 'mTypes' the mappings provided by this script.
 boolean respondsTo(Object optSelf, String verb, int arity)
          Enabled: Does an object whose behavior is this script respond to verb/arity messages?
 Script shorten(Object optSelf, String aVerb, Object[] args)
          Enabled: Returns a Script at least as good as this script for purposes of being execute()d with a message matching the following description.
 

Method Detail

shorten

public Script shorten(Object optSelf,
                      String aVerb,
                      Object[] args)
Enabled: Returns a Script at least as good as this script for purposes of being execute()d with a message matching the following description.

We intend to grow this mechanism into a call-site caching mechanism, but currently it's just to shorten the Java call stack needed for a given E call stack.

If the call won't actually resolve, then shorten may throw the relevant exception, or it may return a Script whose execute will throw that exception. The choice shouldn't matter.

This method represents a start on the mechanism needed for call-site cacheing, but the API will need to change to get their.

Parameters:
optSelf - If present, then a script could shorten using instance-specific data.
aVerb - Must be interned
args - Typically, only its arity is used. But OverloaderNode uses the types of the arguments to select among Java overloads.
Returns:
The Script to use in lieu of this one. Note that it's always correct a Script to just return itself.

execute

public Object execute(Object self,
                      String verb,
                      Object[] args)
Enabled: verb must be an interned string


protocol

public void protocol(Object optSelf,
                     FlexList mTypes)
Enabled: Adds to 'mTypes' the mappings provided by this script.

Parameters:
optSelf - If non-null, and if this script has a match clause, then delegate an __allegedType query to optSelf via the match clause so it can add further elements to mTypes.

Since 'null' is normally a valid value for a 'self', this use of 'null' depends on our knowledge that 'null''s script does not have its own match clause.

mTypes - message descriptions.

respondsTo

public boolean respondsTo(Object optSelf,
                          String verb,
                          int arity)
Enabled: Does an object whose behavior is this script respond to verb/arity messages?

Parameters:
optSelf - If non-null, and if this script has a match clause, and if this script doesn't have a directly matching method, then delegate the respondsTo question to optSelf via the match clause to see if it responds.

Since 'null' is normally a valid value for a 'self', this use of 'null' depends on our knowledge that 'null''s script does not have its own match clause.

verb -
arity -
Returns:


comments?