Operation


Overview

Operation is the abstract super-class of all operations in XMF. An operation can be compiled or interpreted. All operations have parameters, a return type and a body. The body must be performable. An operation is invoked using 'invoke/2' where the first argument is the value of 'self' in the operation body and the second argument is a sequence of parameter values.



Parents BehaviouralFeature ,TypedElement ,DocumentedElement ,NamedElement ,Contained ,Object ,Element


Constructors



Attributes
From TypedElement: type. From DocumentedElement: documentation. From NamedElement: name. From Contained: owner.



Operations
arity():IntegerNo Documentation Specified
break():Element Adds a breakpoint to the receiver. When the receiver is called, execution halts and allows the user to investigate the current context.
breakFun(fun:Element):Element This operation returns a function that can be invoked to enter a break point. When the break point returns the original operation is called.
deployJava(out:OutputChannel):ElementNo Documentation Specified
dynamics():Element The dynamics of an operation are the imported name spaces.
fork():ElementNo Documentation Specified
fork(name:String):ElementNo Documentation Specified
globals():Element The environment of freely referenced variables in the body of the operation.
invoke(target:Element,args:Seq(Element)):Element An operation is performed by invoking it. The arguments are given as the target (the value of self) and the sequence of arguments required by the operation. Deal with var args here by turning any extra arguments into a single argument that is a sequence.
invoke(target:Element,args:Seq(Element),supers:Seq(Operation)):Element An operation is performed by invoking it. The arguments are given as the target (the value of self) and the sequence of arguments required by the operation. Deal with var args here by turning any extra arguments into a single argument that is a sequence. The supers argument is used to supply the supers value allowing the run-super mechanism to restart the lookup.
invokes(target:Element,args:Seq(Element)):Element This version of invoke calculates its supers from its owner which is then passes as the argument to the 3 argument invoke.
isKindOf(c:Classifier):BooleanNo Documentation Specified
javaTypeName(type:Element):StringNo Documentation Specified
matchesId(id:Element):ElementNo Documentation Specified
matchesSignature(op:Element):ElementNo Documentation Specified
matchesTarget(object:Element,target:Element):ElementNo Documentation Specified
name():SymbolNo Documentation Specified
paramNames():Seq(String)No Documentation Specified
populate(sig:Signature):ElementNo Documentation Specified
setDynamics(dynamics:Element):ElementNo Documentation Specified
setGlobals(globals:Element):Element Set the environment of freely reference variables.
setSupers(supers:Seq(Operation)):ElementNo Documentation Specified
setTarget(target:Element):Element Set the value that will be used as 'self' in the evaluation of the body of the operation.
sig():Element Returns the signature of the receiver.
signatureArgs(sig:Signature):ElementNo Documentation Specified
source():StringNo Documentation Specified
supers():Element The supers of an operation define where the search continues when the body performs performs 'super'
target():Element Returns the value of 'self' that was current when the operation was created (unless the operation has been modified since).
trace():Element Call this operation to trace an operation. When the operation is called it will print out on entry and exit.
traceFun(fun:Element):Element This operation returns a function that can be invoked to trace the operation fun.
traced():Boolean Returns true when the received is traced.
unbreak():Element Call this operation to unbreak an operation.
untrace():Element Call this operation to untrace an operation.
From DocumentedElement: setDoc, doc, ensureDoc. From NamedElement: href, toString, setName, repopulate, pathSeq, path, name, getNamedElement. From Contained: owner, deleteRecursive, allOwners, addTo, setOwner, removeFromOwner. From Object: slotMissing, slotMissing, setProperty, setHotLoad, setDaemonsActive, setDaemons, set, renameSlot, removeStructuralFeature, removeDaemonsWithTarget, removeDaemonsWithId, removeDaemonNamed, removeDaemon, machineInit, initSlots, init, hotLoaded, hotLoad, hasSlot, hasProperty, getProperty, get, hasStructuralFeature, getStructuralFeatureNames, hasDaemonWithTarget, hasDaemonWithIdAndTarget, hasDaemonWithId, hasDaemonNamed, fire, destroyDaemon, daemonWithIdAndTarget, daemonWithId, daemonNamed, daemonsActive, daemons, allDaemonsWithTarget, allDaemonsWithId, compositeValues, allCompositeValuesAndSelf, allCompositeValues, addStructuralFeature, addPersistentDaemon, addMultiDaemon, addDaemon. From Element: pprint, pprint, pprint, writeXMLFile, writeXMLFile, writeXML, lift, toSnapshot, toSnapshot, allHTMLEntries, allHTMLPackages, toHTML, writeHTML, writeHTML, writeHTMLAllEntries, writeHTMLAllPackages, writeHTMLIndex, writeHTMLOverview, yield, toString, systemId, setOf, send, save2, save, removeDaemon, removeDaemon, println, print, oclIsKindOf, oclIsTypeOf, noOperationFound, isTypeOf, isReallyKindOf, init, init, of, isKindOf, addTo, checkConstraints, copy, deleteRecursive, die, edit, equals, error, ferror, hashCode.



Grammar
ReturnType ::=  ':'   TypeExp  | { NamedType() }.
Keywordp-Star0 ::=  '::'   Name   = $head   Keywordp-Star0   = $tail   Cons  |  Nil .
Properties ::=  '['   Property   = p   Properties-Star0   = ps   ']'     |  Seq{} .
AddPattern-Dis0 ::=  '+'   AddPattern   = p2  { Addp(p1,p2) } |   .
OpMulti ::=  '.'   Pattern   = multi  { Seq{multi} } |  Seq{} .
SeqExp ::=  LinePos   = l   'Seq{'   SeqExp-Dis0 .
Property ::=  Name   = n   '='   Exp   = e  { Seq{n,e} }.
Varp ::=  AName   = name   Varp-Dis0   = pattern   Varp-Dis1   = type  { Varp(name,pattern,type) }.
OpArg ::=  Pattern  |  '!'   Drop .
Import ::=  'import'   ImportPath   = path   ';'  { Import(path) }.
Properties-Star0 ::=  ','   Property   = $head   Properties-Star0   = $tail   Cons  |  Nil .
NonEmptySeqTail ::=  Expr   = e   PairOrElements .
OpArgs ::=  OpArg   = arg   OpArgs-Star0   = args     |  Seq{} .
BindValue ::=  OptType   = type   '='   SimpleExp   = value  { ValueBinding(name,type,value) }.
OpArgs-Star0 ::=  ','   OpArg   = $head   OpArgs-Star0   = $tail   Cons  |  Nil .
Drop ::=  '<'   DropExp   = e   '>'  { Drop(resolve(order(e))) } |  '<|'   Pattern   = p   '|>'  { DropPattern(p) }.
OpName ::=  AName   = name  { if name.isKindOf(String)
then
  Symbol(name)
else
  name
end } | { Symbol("anonymous") }.
BindFunArgsTail ::=  Pattern   = p   BindFunArgsTail-Star0   = ps   ')'     |  ')'   Seq{} .
Operation-PlusCons0 ::=  Exp   = $head   Operation-PlusCons0-Star0   = $tail   Cons .
AddPattern ::=  AtomicPattern   = p1   AddPattern-Dis0 .
Operation ::=  OpName   = name   Properties   = ps   '('   OpArgs   = args   OpMulti   = multi   ')'   ReturnType   = type   Operation-PlusCons0   = body   'end'   pState   = p  { ps->iterate(p x = Operation(name,args + multi,type).add(body).setIsMultiArgs(not multi->isEmpty).setImports(p.imports->excluding(XCore)->excluding(Root)->map("pathSeq")) |
  [| .setProperty(at(0))>,at(1)>) |]) }.
IfTail ::=  'else'   Expr   'end'  |  LinePos   = l   'elseif'   Expr   = e1   'then'   Expr   = e2   IfTail   = e3  { If(l,e1,e2,e3) } |  'end'  { BoolExp(false) }.
Operation-PlusCons0-Star0 ::=  Exp   = $head   Operation-PlusCons0-Star0   = $tail   Cons  |  Nil .
Def ::=  'context'   Def-Dis0   = isForward   ImportPath   = path   Exp   = exp  { ContextDef(path,exp,isForward) }.
Def-Dis0 ::=  '!'  { true } | { false }.
SetExp ::=  LinePos   = l   'Set{'   CommaSepExps   = es   '}'  { SetExp(l,"Set",es) }.
Throw ::=  LinePos   = l   'throw'   SimpleExp   = value  { Throw(l,value) }.
LogicalExp ::=  SimpleExp   = e  { resolve(order(e)) }.
Pattern-Star0 ::=  PatternTail   = $head   Pattern-Star0   = $tail   Cons  |  Nil .
Keyps-Star0 ::=  ','   Keyp   = $head   Keyps-Star0   = $tail   Cons  |  Nil .
Keywordp ::=  Name   = name   Keywordp-Star0   = names   '['   Keyps   = keys   ']'  { Keywordp(name,names,keys) }.
VarExp ::=  Name   = name   LinePos   = l  { Var(name,l) }.
Parentheses ::=  '('   Expr   = e   ')'  { Parentheses(e) }.
KeyArgs-Dis0 ::=  ']'   Seq{}  |  KeyArg   = arg   KeyArgs-Dis0-Star0   = args   ']'    .
CollMessage ::=  '('   CommaSepExps   = as   ')'  { CollExp(c,n,as) }.
ArgsTail-Star0 ::=  ','   Expr   = $head   ArgsTail-Star0   = $tail   Cons  |  Nil .
Exp ::=  Expr   = e   !  { resolve(order(e)) }.
Seqp ::=  'Seq{'   Pattern   = head   SeqpTail   = tail  { Consp(head,tail) }.
ArrowTail ::=  Name   = n   CollOp   = x   Arrow .
Varp-Dis0 ::=  '='   Pattern  |  null .
Atom ::=  VarExp   !  |  Self   !  |  StrExp   !  |  IntExp   !  |  IfExp   !  |  BoolExp   !  |  LetExp   !  |  CollExp   !  |  Parentheses  |  Drop  |  Lift  |  Throw  |  Try  |  ImportIn  |  FloatExp  |  LocalParserImport  |  AtExp .
ImportPath ::=  Name   = n   ImportPath-Star0   = ns    .
EvaluationUnit ::=  EvaluationUnit-Star0   EvaluationUnit-Star1   = imports   EvaluationUnit-Star2   = exps   EOF  { Evaluator::EvaluationUnit(imports,exps) }.
Objectp ::=  Name   = name   Objectp-Star0   = names   '('   Patterns   = slots   ')'  { Objectp(name,names,slots) }.
CollOp ::=  CollMessage  |  Collect  |  Iterate  | { CollExp(c,n,Seq{}) }.
BindingList ::=  Binding   = binding   BindingList-Star0   = bindings    .
ParserImport ::=  'parserImport'   Name   = name   ParserImport-Star0   = names   ';'     ImportAt.
DropExp ::=  'not'   DropExp   = e  { Negate(e) } |  Apply   = a   DropExpTail .
KeyArg ::=  Name   = name   '='   Expr   = exp  { KeyArg(name,exp) }.
BindFunArgs ::=  '('   BindFunArgsTail .
Patterns-Star0 ::=  ','   Pattern   = $head   Patterns-Star0   = $tail   Cons  |  Nil .
AName ::=  Name   !  |  Drop .
Syntaxp ::=  '[|'   Exp   = e   '|]'  { Syntaxp(e) }.
IfExp ::=  LinePos   = l   'if'   Expr   = e1   'then'   Expr   = e2   IfTail   = e3  { If(l,e1,e2,e3) }.
CompilationUnit-Star0 ::=  ParserImport   = $head   CompilationUnit-Star0   = $tail   Cons  |  Nil .
Constp ::=  Intp  |  Strp  |  Boolp  |  Expp .
EvaluationUnit-Star2-Dis0 ::=  Def  |  TopLevelExp .
Self ::=  LinePos   = l   'self'  { Self(l) }.
TopLevelExp ::=  SimpleExp   = s   ';'  { resolve(order(s)) }.
LocalParserImport ::=  'parserImport'   Name   = name   LocalParserImport-Star0   = names     ImportAt  'in'   Expr   = e   'end'  { ParserImport(Seq{name | names},e) }.
PathExp-Dis0 ::=  '::'   AName   = name   PathExp-Dis0-Star0   = names  { Path(atom,Seq{name | names}) } |   .
LocalParserImport-Star0 ::=  '::'   Name   = $head   LocalParserImport-Star0   = $tail   Cons  |  Nil .
Keyps ::=  Keyp   = key   Keyps-Star0   = keys     |  Seq{} .
Try ::=  LinePos   = l   'try'   Expr   = body   'catch'   '('   Name   = name   ')'   Expr   = handler   'end'  { Try(l,body,name,handler) }.
PathExp ::=  Atom   = atom   PathExp-Dis0 .
KeyArgs-Dis0-Star0 ::=  ','   KeyArg   = $head   KeyArgs-Dis0-Star0   = $tail   Cons  |  Nil .
Collect ::=  '('   AName   = v   '|'   Expr   = e   ')'  { IterExp(c,n,v,e) }.
BindFunArgsTail-Star0 ::=  ','   Pattern   = $head   BindFunArgsTail-Star0   = $tail   Cons  |  Nil .
Expr ::=  'not'   Expr   = e  { Negate(e) } |  '-'   SimpleExp   = e  { BinExp(IntExp(0),"-",e) } |  Apply   = a   ExpTail .
SeqpTail ::=  ','   Pattern   = head   SeqpTail   = tail  { Consp(head,tail) } |  '}'  { Constp(SetExp("Seq",Seq{})) }.
ArgsTail ::=  ')'   Seq{}  |  Expr   = arg   ArgsTail-Star0   = args   ')'    .
Varp-Dis1 ::=  ':'   TypeExp  | { NamedType() }.
AtExp ::=  LinePos   = l   '@'  At  = e  { e.setLine(l) }.
ImportIn ::=  'import'   ImportPath   = path   'in'   Exp   = body   'end'  { ImportIn(path,body) }.
EmptySeqTail ::=  '}'  { SetExp(l,"Seq",Seq{}) }.
Op ::=  BinOp   !  |  ';'   ; .
CollExp ::=  SetExp   !  |  SeqExp   ! .
Bindings ::=  BindingList  |  Drop .
Pairp ::=  'Seq{'   Pattern   = head   '|'   Pattern   = tail   '}'  { Consp(head,tail) }.
DropExpTail ::=  DropOp   = o   !   DropExp   = e  { BinExp(a,o,e) } |   .
KeyArgs ::=  '['   KeyArgs-Dis0 .
BindFun ::=  BindFunArgs   = args   OptType   = type   '='   SimpleExp   = value  { FunBinding(name,args,type,value) }.
SeqExp-Dis0 ::=  EmptySeqTail  |  NonEmptySeqTail .
Apply ::=  Atom   = a   ApplyTail   = e   Arrow .
Strp ::=  Str   = s  { Constp(StrExp(s)) }.
FloatExp ::=  LinePos   = l   Float   = f  { f.lift().line := l }.
CompilationUnit-Star1 ::=  Import   = $head   CompilationUnit-Star1   = $tail   Cons  |  Nil .
Consp ::=  Pairp  |  Seqp  |  Emptyp .
EvaluationUnit-Star2 ::=  EvaluationUnit-Star2-Dis0   = $head   EvaluationUnit-Star2   = $tail   Cons  |  Nil .
Patterns ::=  Pattern   = head   Patterns-Star0   = tail     |  Seq{} .
TopLevelCommand ::=  SimpleExp   = c   pState   = p  { p.consumeToken := false }  ';'  { resolve(order(c)) }.
Lift ::=  LinePos   = l   '[|'   Exp   = e   '|]'  { Lift(l,e) }.
PathExp-Dis0-Star0 ::=  '::'   AName   = $head   PathExp-Dis0-Star0   = $tail   Cons  |  Nil .
Objectp-Star0 ::=  '::'   Name   = $head   Objectp-Star0   = $tail   Cons  |  Nil .
Keyp ::=  Name   = name   '='   Pattern   = pattern  { Keyp(name,pattern) }.
TypePath ::=  Name   = name   TypePath-Star0   = names  { Seq{name | names}->collect(n |
  Symbol(n)) }.
Pattern ::=  AddPattern   = p   Pattern-Star0   = es  { es->iterate(e s = p |
  Includingp(s,e)) }  = p   PatternGuard .
ImportPath-Star0 ::=  '::'   Name   = $head   ImportPath-Star0   = $tail   Cons  |  Nil .
CommaSepExps ::=  Expr   = e   CommaSepExps-Star0   = es     |  Seq{} .
BindingList-Star0 ::=  ';'   Binding   = $head   BindingList-Star0   = $tail   Cons  |  Nil .
ExpTail ::=  Op   = o   !   Expr   = e  { BinExp(a,o,e) } |   .
SimpleExp ::=  'not'   SimpleExp   = e  { Negate(e) } |  '-'   SimpleExp   = e  { BinExp(IntExp(0),"-",e) } |  Apply   = a   SimpleExpTail .
Args ::=  '('   ArgsTail .
TypePath-Star0 ::=  '::'   Name   = $head   TypePath-Star0   = $tail   Cons  |  Nil .
AtomicPattern ::=  Varp  |  Constp  |  Objectp  |  Consp  |  Keywordp  |  Syntaxp  |  '('   Pattern   ')' .
IntExp ::=  LinePos   = l   Int   = e  { IntExp(l,e) }.
Emptyp ::=  'Seq{'   '}'  { Constp(SetExp("Seq",Seq{})) } |  'Set{'   '}'  { Constp(SetExp("Set",Seq{})) }.
OpType ::=  TypeArgs   = domains   '->'   TypeExp   = range  { OpType(domains,range) }.
Boolp ::=  'true'  { Constp(BoolExp(true)) } |  'false'  { Constp(BoolExp(false)) }.
BinOp ::=  '<'   <  |  '<='   <=  |  '>'   >  |  '>='   >=  |  '<>'   <>  |  '='   =  |  '::'   ::  |  ':='   :=  |  '.'   .  |  'and'   and  |  'andthen'   andthen  |  'implies'   implies  |  'or'   or  |  'orelse'   orelse  |  '+'   +  |  '-'   -  |  '*'   *  |  '/'   / .
PairOrElements ::=  '|'   Expr   = t   '}'  { ConsExp(e,t) } |  PairOrElements-Star0   = es   '}'  { SetExp(l,"Seq",Seq{e | es}) }.
DropOp ::=  '<'   <  |  '<='   <=  |  '<>'   <>  |  '='   =  |  '::'   ::  |  ':='   :=  |  '.'   .  |  'and'   and  |  'andthen'   andthen  |  'implies'   implies  |  'or'   or  |  'orelse'   orelse  |  '+'   +  |  '-'   -  |  '*'   *  |  '/'   / .
Iterate ::=  '('   AName   = v1   AName   = v2   '='   Expr   = init   '|'   Expr   = body   ')'  { Iterate(c,v1,v2,init,body) }.
BindingTail ::=  BindFun  |  BindValue .
TypeExp-Dis0 ::=  TypeArgs   = args  { ParametricType(path,args) } | { NamedType(path) }.
ApplyTail ::=  Args   = args   !  { Apply(a,args) } |  KeyArgs   = args   !  { Instantiate(a,args) } |   .
StrExp ::=  LinePos   = l   Str   = e  { StrExp(l,e) }.
Expp ::=  '['   Exp   = exp   ']'  { Constp(exp) }.
CompilationUnit-Star2 ::=  CompilationBody   = $head   CompilationUnit-Star2   = $tail   Cons  |  Nil .
CompilationBody ::=  Def  |  TopLevelExp .
EvaluationUnit-Star1 ::=  EImport   = $head   EvaluationUnit-Star1   = $tail   Cons  |  Nil .
PatternTail ::=  '->'   Name   '('   Pattern   = p   ')'    .
TypeExp ::=  TypePath   = path   TypeExp-Dis0  |  Drop  |  OpType .
LetExp ::=  LinePos   = l   'let'   Bindings   = bindings   LetBody   = body   'end'  { Let(l,bindings,body) }.
ParserImport-Star0 ::=  '::'   Name   = $head   ParserImport-Star0   = $tail   Cons  |  Nil .
PairOrElements-Star0 ::=  ','   Expr   = $head   PairOrElements-Star0   = $tail   Cons  |  Nil .
LetBody ::=  'in'   Expr   = body     |  'then'   Bindings   = bindings   LetBody   = body  { Let(bindings,body) }.
TypeArgs ::=  '('   TypeExp   = arg   TypeArgs-Star0   = args   ')'    .
PatternGuard ::=  'when'   Exp   = e  { Condp(p,e) } |   .
EvaluationUnit-Star0 ::=  ParserImport   = $head   EvaluationUnit-Star0   = $tail   Cons  |  Nil .
CompilationUnit ::=  CompilationUnit-Star0   CompilationUnit-Star1   = imports   CompilationUnit-Star2   = exps   EOF   pState   = s  { CompilationUnit("",imports,exps,s.getSource()) }.
CommaSepExps-Star0 ::=  ','   Expr   = $head   CommaSepExps-Star0   = $tail   Cons  |  Nil .
Exp1 ::=  Exp   EOF .
SimpleExpTail ::=  BinOp   = o   !   SimpleExp   = e  { BinExp(a,o,e) } |   .
Arrow ::=  '->'   !   ArrowTail  |   .
TypeArgs-Star0 ::=  ','   TypeExp   = $head   TypeArgs-Star0   = $tail   Cons  |  Nil .
Binding ::=  AName   = name   BindingTail .
Intp ::=  Int   = i  { Constp(IntExp(i)) }.
EImport ::=  'import'   TopLevelExp   = exp  { Evaluator::Import(exp) }.
OptType ::=  ':'   TypeExp  | { NamedType() }.
BoolExp ::=  LinePos   = l   'true'  { BoolExp(l,true) } |  LinePos   = l   'false'  { BoolExp(l,false) }.