Dirk Herrmann <[EMAIL PROTECTED]> writes:

>   scm_misc_error 
>     (name,
>      "Observers of `~A' have signalled the following errors: ~S",
>      scm_cons2 (env, ordered_errors, SCM_UNDEFINED));
                                       ^^^^^^^^^^^^^
(I assume that should be SCM_EOL.)

> It's almost the way I want it to be, except for the fact, that the `name'
> parameter is completely ignored by scm_misc_error (or, rather, scm_ithrow
> and where that ends).  It seems as if the last error on the scheme level
> somehow still influences the generation of the error message.

Here's a piece of backtrace.c:display_error_body:

  if (SCM_DEBUGGINGP
      && SCM_STACKP (a->stack)
      && SCM_STACK_LENGTH (a->stack) > 0)
    {
      current_frame = scm_stack_ref (a->stack, SCM_INUM0);
      source = SCM_FRAME_SOURCE (current_frame);
      prev_frame = SCM_FRAME_PREV (current_frame);
      if (!SCM_MEMOIZEDP (source) && !SCM_FALSEP (prev_frame))
        source = SCM_FRAME_SOURCE (prev_frame);
      if (SCM_FRAME_PROC_P (current_frame)
          && SCM_EQ_P (scm_procedure_p (SCM_FRAME_PROC (current_frame)), SCM_BOOL_T))
        pname = scm_procedure_name (SCM_FRAME_PROC (current_frame));
    }
  if (!SCM_ROSTRINGP (pname))
    pname = a->subr;
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  if (SCM_ROSTRINGP (pname) || SCM_MEMOIZEDP (source))
    {
      display_header (source, a->port);
      display_expression (current_frame, pname, source, a->port);
    }
  display_header (source, a->port);
  scm_display_error_message (a->message, a->args, a->port);

The underlined statement lets the information from the last saved
stack (pname) override the name passed in the throw (a->subr) by not
using the latter in case the stack info is valid.

I don't remember why this is so.  But probably, the stack frame
information was a lot more reliable at the time when this code was
written.

Maybe the code should be changed so that the name passed by throw
should override the stack frame info.

[I apologize for the shape of the code in stacks.c and backtrace.c.]

Reply via email to