|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
TypeTag
The public interface to a native type tag object.
Type tags consist of two properties:
Types have one important operation: one type can be tested to be a subtype of another type.
Type tags are very similar to empty Java-like interface types, and their main purpose lies in the *classification* of objects. AmbientTalk Objects can be tagged with zero or more type tags.
Method Summary | |
---|---|
Object |
annotateMessage(Object originalMessage)
Invoked on a type tag when the type tag is used to annotate asynchronous message sends. |
Method |
annotateMethod(Method originalMethod)
Invoked on a type tag when the type tag is used to annotate method definitions. |
Boolean |
isSubtypeOf(TypeTag other)
Returns true if this type tag is a subtype of a given type tag. |
Table |
superTypes()
Returns a table with the supertypes of this type tag. |
Symbol |
typeName()
Returns the name of this type tag. |
Methods inherited from interface edu.vub.at.objects.Object |
---|
super |
Method Detail |
---|
Symbol typeName()
Symbol
representing the unique name by which the type can be identified.Table superTypes()
Table
with the super types of the receiver type tags.Boolean isSubtypeOf(TypeTag other)
More specifically, what the native implementation (expressed in AmbientTalk syntax) does is:
def isSubtypeOf(supertype) {
(supertype.name() == name).or:
{ (supertypes.find: { |stype| stype.isSubtypeOf(supertype) }) != nil }
};
other
- a type.
Object annotateMessage(Object originalMessage)
obj<-m(args)@Type
The interpreter will invoke:
Type.annotateMessage(msg)
where msg is the message <-m(args)
The return value of the annotate method is an extended message which will be used during
message sending. When a message is annotated with multiple type tags, the annotate methods
of these different type tags are chained to produce the final message.
originalMessage
- the message to annotate
Method annotateMethod(Method originalMethod)
def method(arg1, ..., argN) @Type { ... }
the interpreter will invoke Type.annotateMethod(meth)
where meth
is a method object with the given name, arguments and body. The return value of the
annotateMethod is an extended method object which will be installed in the method
dictionary. The object can override e.g. apply to intervene when the method is being
applied. When a method definition is annotated with multiple type tags, the annotate
methods of these different type tags are chained to produced the final method object.
originalMethod
- the method to annotate
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |