Skip to content

Better and more consistent user info string produced by ErrorReturnVoid #6272

@fingolfin

Description

@fingolfin

We noticed some suboptimal error info messages, e.g.

Error, recursion depth trap (1000)
*[1] dive( depth - 1 );
   @ *stdin*:4
 [2] dive( depth - 1 );
   @ *stdin*:4
...  at *stdin*:12
you may 'return;'Collapse comment

Note the absence of the you can 'quit;' to quit to outer loop, or part before the "you may return".

Digging deeper I discovered that in GAP 4.4, we got this:

Entering break read-eval-print loop ...
you can 'quit;' to quit to outer loop, or
you can 'return;' after assigning a value to continue

but starting with GAP 4.5 it was as it is now.

I really think this line should be added back. It should probably be inserted into ErrorReturnVoid (and if msg2 is left 0, a default message is used).

I dug some more and discovered that the "you may return" message also has quite some variance. I found:

  • you may 'return;'
  • you can 'return;'
  • you can 'return;' to continue

Plus a bunch of custom ones:

  • you can 'return;' as if the sleep was finished
  • you can 'return;' as if the microsleep was finished
  • You can `return;' to ignore the assignment (note use of a single backtick in the message)
  • You can `return;' to ignore the operation (again with a single backtick)
  • you may 'return;' to skip the reduction
  • You may return after raising the limit with SetCyclotomicsLimit
  • ... or no message

On the library side, it is mostly uniform thanks to this function (we should keep the message consistent between it and the kernel):

OnBreakMessage := function()
  Print("you can 'quit;' to quit to outer loop, or\n",
        "you can 'return;' to continue\n");
end;

Fun fact: the coset enumerator code changes this temporarily to be able to print a different message:

    # to give tidy instructions if one enters a break-loop
    SavedOnBreakMessage := OnBreakMessage;
    TCEOnBreakMessage := function(n)
      Print( "type 'return;' if you want to continue with a new limit of ",
             n, " cosets,\n",
             "type 'quit;' if you want to quit the coset enumeration,\n",
             "type 'maxlimit := 0; return;' in order to continue without a ",
             "limit\n" );
      OnBreakMessage := SavedOnBreakMessage;
    end;

which is fine, but again, should ideally be kept somewhat consistent with the rest.

I can take care of this once PR #6263 is merged.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions