7.1 Recovery from NoMethodFound-Errors

When the method selection fails because there is no applicable method, an error as in the following example occurs and a break loop is entered:

gap> IsNormal(2,2);
For debugging hints type ?Recovery from NoMethodFound
Error no 1st choice method found for `IsNormalOp' on 2 arguments at
Error( inf );
oper( super, sub ) called from
<function>( <arguments> ) called from read-eval-loop
Entering break read-eval-print loop, you can 'quit;' to quit to outer loop,
or you can return to continue
brk> 

This only says, that the method selection tried to find a method for the operation IsNormalOp on two arguments and failed. In this situation it is crucial to find out, why this happened. Therefore there are a few functions which can display further information. Note that you can leave the break loop by the quit command (see quit) and that the information about the incident is no longer accessible afterwards.

  • ShowArguments( ) F

    This function is only available within a break loop caused by a ``No Method Found''-error. It prints as a list the arguments of the operation call for which no method was found.

  • ShowArgument( nr ) F

    This function is only available within a break loop caused by a ``No Method Found''-error. It prints the nr-th arguments of the operation call for which no method was found. ShowArgument needs exactly one argument which is an integer between 0 and the number of arguments the operation was called with.

  • ShowDetails( ) F

    This function is only available within a break loop caused by a ``No Method Found''-error. It prints the details of this error: The operation, the number of arguments, a flag which indicates whether the operation is being traced, a flag which indicates whether the operation is a constructor method, and the number of methods that refused to apply by calling TryNextMethod. The last number is called Choice and is printed as an ordinal. So if exactly k methods were found but called TryNextMethod and there were no more methods it says Choice: kth.

  • ShowMethods( ) F
  • ShowMethods( verbosity ) F

    This function is only available within a break loop caused by a ``No Method Found''-error. It prints an overview about the installed methods for those arguments the operation was called with (using ApplicableMethod, see ApplicableMethod). The verbosity can be controlled by the optional integer parameter verbosity. The default is 2, which lists all applicable methods. With verbosity 1 ShowMethods only shows the number of installed methods and the methods matching, which can only be those that were already called but refused to work by calling TryNextMethod. With verbosity 3 not only all installed methods but also the reasons why they do not match are displayed.

  • ShowOtherMethods( ) F
  • ShowOtherMethods( verbosity ) F

    This function is only available within a break loop caused by a ``No Method Found''-error. It prints an overview about the installed methods for a different number of arguments than the number of arguments the operation was called with (using ApplicableMethod, see ApplicableMethod). The verbosity can be controlled by the optional integer parameter verbosity. The default is 1 which lists only the number of applicable methods. With verbosity 2 ShowOtherMethods lists all installed methods and with verbosity 3 also the reasons, why they are not applicable. Calling ShowOtherMethods with verbosity 3 in this function will normally not make any sense, because the different numbers of arguments are simulated by supplying the corresponding number of ones, for which normally no reasonable methods will be installed.

    [Top] [Up] [Next] [Index]

    GAP 4 manual
    February 2000