Download The SELF 4.1 Programmer`s Reference Manual
Transcript
SELF Virtual Machine Reference Run-time message lookup errors There are other situations in which the system sends messages; see section 5.3. 5.3 Run-time message lookup errors If an error occurs during a message send, the system sends a message to the receiver of the message. Any object can handle these errors by defining (or inheriting) a slot with the corresponding selector. All messages sent by the system in response to a message lookup error have the same arguments. The first argument is the offending message’s selector; the additional arguments specify the message send type (one of ’normal’, ’implicitSelf’, ’undirectedResend’, ’directedResend’, or ’delegated’), the directed resend parent name or the delegatee (0 if not applicable), the sending method holder, and a vector containing the arguments to the message, if any. • undefinedSelector:Type:Delegatee:MethodHolder:Arguments: The receiver does not understand the message: no slot matching the selector can be found in the receiver or its ancestors. • ambiguousSelector:Type:Delegatee:MethodHolder:Arguments: There is more than one slot matching the selector. • missingParentSelector:Type:Delegatee:MethodHolder:Arguments: The parent slot through which the resend should have been directed was not found in the sending method holder. • mismatchedArgumentCountSelector:Type:Delegatee:MethodHolder:Arguments: The number of arguments supplied to the _Perform primitive does not match the number of arguments required by the selector. • performTypeErrorSelector:Type:Delegatee:MethodHolder:Arguments: The first argument to the _Perform primitive (the selector) wasn’t a canonical string. These error messages are just like any other message. Therefore, it is possible that the object P causing the error (which is being sent the appropriate error message) does not understand the error message M either. If this happens, the system sends the first message (undefinedSelector..) to the current process, with the error message M as argument. If this is not understood, then the system suspends the process. If the scheduler is running, it is notified of the failure. The system will also suspend a process if it runs out of stack space (too much recursion) or if a block is evaluated whose lexically-enclosing scope has already returned. Since these errors are nonrecoverable they cannot be caught by the same SELF process; the scheduler, if running, is notified. 5.4 Low-level error messages Five kinds of errors can occur during the execution of a SELF program: lookup errors, primitive errors, programmer defined errors, non-recoverable errors, and fatal VM errors. All but the last of these are usually caught and handled by mechanisms in the programming environment, resulting in a debugger being presented to the user. However, if programs are run without the programming 63