|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The public interface to a native AmbientTalk closure (a method + enclosing environment). Since ATMethods are always wrapped either at creation time (blocks) or during lookup (methods), ATClosures are by definition the only way methods and blocks can be encountered at the ambienttalk base level. Closures should respond to the base_apply method, which should trigger the invocation of their encapsulating method in the enclosed closure context. Closures are sometimes also 'abused' to simply represent blocks of source code whose body has to be evaluated not in the enclosed lexical context, but within the context of another object. To facilitate such use, a closure provides the method 'base_applyInScope' which will execute the enclosed method in the scope of the given object, rather than in the enclosed lexical context.
Method Summary | |
ATObject |
base_apply(ATTable args)
Applies the closure to the given arguments, already wrapped in a table. |
ATObject |
base_applyInScope(ATTable args,
ATObject scope)
Applies the closure to the given arguments, already wrapped in a table. |
ATObject |
base_escape()
{ |quit| ... quit(val) ... }.escape() The escape control construct passes to its receiver block a function which when invoked, immediately transfers control back to the caller of escape, returning the value passed to quit. |
ATContext |
base_getContext()
Structural access to the scope of the closure. |
ATMethod |
base_getMethod()
Structural access to the encapsulated method. |
ATObject |
base_whileTrue_(ATClosure body)
Allows AmbientTalk programmers to write { booleanCondition }.whileTrue: { body } which will execute body as long as the boolean condition evaluates to true. |
Methods inherited from interface edu.vub.at.objects.ATObject |
base__opeql__opeql_, base_init, base_new, meta_addField, meta_addMethod, meta_assignField, meta_assignVariable, meta_clone, meta_defineField, meta_doesNotUnderstand, meta_eval, meta_extend, meta_getDynamicParent, meta_getLexicalParent, meta_getStripes, meta_grabField, meta_grabMethod, meta_invoke, meta_isCloneOf, meta_isRelatedTo, meta_isStripedWith, meta_listFields, meta_listMethods, meta_lookup, meta_newInstance, meta_pass, meta_print, meta_quote, meta_receive, meta_resolve, meta_respondsTo, meta_select, meta_send, meta_share |
Method Detail |
public ATMethod base_getMethod() throws InterpreterException
InterpreterException
public ATContext base_getContext() throws InterpreterException
InterpreterException
public ATObject base_apply(ATTable args) throws InterpreterException
args
- the already evaluated arguments, wrapped in a table
InterpreterException
public ATObject base_applyInScope(ATTable args, ATObject scope) throws InterpreterException
args
- the already evaluated arguments, wrapped in a tablescope
- the object that will act as self and as lexically enclosing scope.
InterpreterException
public ATObject base_whileTrue_(ATClosure body) throws InterpreterException
InterpreterException
public ATObject base_escape() throws InterpreterException
InterpreterException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |