Subject: bug#15691: ,br doesn't work for generic functions

From: Ian Price <[email-masked]>
Date: Thu, 24 Oct 2013 05:53:12 +0100

Jordy Dickinson <[email-masked]> writes:

> # What I expected:
>
> I wasn't sure what to expect, given that generic functions can have
> many implementations, but since there was no error and a "generic"
> object appeared in the output of ",traps", I expected at least that
> when _some_ initialize method was called I would be put into a
> debugging prompt.

Indeed, there are two reasonable behaviours here.

1. We stop before method specialisation in the "top level" of the
function returned by (procedure <some-generic>). This is the behaviour I
would expect for an arbitrary applicable struct.

2. We stop after method specialisation. This requires goops specific
hackery, but is probably more helpful if we could pull it off.

>
> # What actually happened:
>
> When I called a function that called the initialize method ("make" in
> this particular case), it completed successfully, without any debug
> prompt.

The reason this happens is that in the procedure `frame-matcher' in
(system vm traps), it tests for the equivalence of the procedure passed
in, with the procedure in the frame with eq?. In the first instance, the
procedure is an applicable struct, the latter however is the function
returned by (procedure that-applicable-struct).

We could either fix this a bit further up the stack, by making sure that
we extract the procedure from applicable structs, we could extract it
in `frame-matcher'.

I think `frame-matcher' is the right place to fix this, rather than
further up the stack. Various procedures in (system vm traps) are
documented as taking a procedure, which IMO should include applicable
structs.

I've attached a patch which handles this, implementing behaviour (1)
above.

-- 
Ian Price -- shift-reset.com

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"