4.6. The dynamic type

A method which is implemented outside TOM (say, in C) can have a dynamic return type and dynamic argument types. A dynamic type implies anything can be passed and will be accepted. The type of the value actually passed to the method is encoded in the selector, which the method receives as the implicit second argument (after self). Similarly, the method implementation can deduce the expected return type from actual selector. The dynamic type is used by, for instance, the perform : method, which is defined as


extern dynamic
  perform selector sel
        : Array arguments = nil;

If perform : is invoked as


int a, b, c;

(a, b, c) = [foo perform bar]

then it would be a (fatal) runtime error if the selector denoted by bar did not return a tuple of three integers.