From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ian Price Newsgroups: gmane.lisp.guile.bugs Subject: bug#15691: ,br doesn't work for generic functions Date: Thu, 24 Oct 2013 05:53:12 +0100 Message-ID: <877gd3xoav.fsf@Kagami.home> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1382590451 30707 80.91.229.3 (24 Oct 2013 04:54:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 24 Oct 2013 04:54:11 +0000 (UTC) Cc: 15691@debbugs.gnu.org To: Jordy Dickinson Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Thu Oct 24 06:54:16 2013 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VZCw2-0001Ym-NB for guile-bugs@m.gmane.org; Thu, 24 Oct 2013 06:54:14 +0200 Original-Received: from localhost ([::1]:52486 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZCw2-0006I4-7Y for guile-bugs@m.gmane.org; Thu, 24 Oct 2013 00:54:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53675) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZCvv-0006Hw-GS for bug-guile@gnu.org; Thu, 24 Oct 2013 00:54:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VZCvq-0001pz-P5 for bug-guile@gnu.org; Thu, 24 Oct 2013 00:54:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54056) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZCvq-0001pt-Kb for bug-guile@gnu.org; Thu, 24 Oct 2013 00:54:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VZCvq-0006e4-2M for bug-guile@gnu.org; Thu, 24 Oct 2013 00:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ian Price Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 24 Oct 2013 04:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15691 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 15691-submit@debbugs.gnu.org id=B15691.138259040625492 (code B ref 15691); Thu, 24 Oct 2013 04:54:01 +0000 Original-Received: (at 15691) by debbugs.gnu.org; 24 Oct 2013 04:53:26 +0000 Original-Received: from localhost ([127.0.0.1]:39842 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VZCvF-0006d5-3C for submit@debbugs.gnu.org; Thu, 24 Oct 2013 00:53:25 -0400 Original-Received: from mail-wi0-f179.google.com ([209.85.212.179]:58150) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VZCvB-0006co-FD for 15691@debbugs.gnu.org; Thu, 24 Oct 2013 00:53:22 -0400 Original-Received: by mail-wi0-f179.google.com with SMTP id hm4so1929123wib.0 for <15691@debbugs.gnu.org>; Wed, 23 Oct 2013 21:53:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=Fgiyz2O43myY5bN5+inhlz9ETr9dZSbI6bM1RQ8oRiQ=; b=LH5ZlQsO+HLkG/1DLouLkwcBfmZNhONu0rQyEcdAZJ81aFXXGZHQxW00XCePb0jP6H 1Fte9CSMzBBAQODGiowCdwvwfQb8BCMfraXBybPx9TUPFzU0L0DaFXYlhkkz75OCqmAT KqS6f1AaBcMR0yNmfy5F0ntOcG+w8v6f+0oNxfyF0LeaasV/wOjsMkknHAUR1jA8dVu+ /4exp3PVqpjAc3fidY3/Zt2mhTH3Jwf3Po3CNKhK37WgCbRxCMB1ztJzyQSYa7n7sHva c/lbRrQV+lM6rNbG15UtHvcfueviXk3mY2KuisPZ72+8OZgWWZS+mHKqicqOlWM4vM7B vmow== X-Received: by 10.180.210.231 with SMTP id mx7mr375494wic.5.1382590395609; Wed, 23 Oct 2013 21:53:15 -0700 (PDT) Original-Received: from Kagami.home (host86-132-92-201.range86-132.btcentralplus.com. [86.132.92.201]) by mx.google.com with ESMTPSA id ey4sm23404183wic.11.2013.10.23.21.53.13 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 23 Oct 2013 21:53:14 -0700 (PDT) In-Reply-To: (Jordy Dickinson's message of "Wed, 23 Oct 2013 01:51:25 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7320 Archived-At: --=-=-= Content-Type: text/plain Jordy Dickinson 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 ). 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" --=-=-= Content-Type: #("text/x-patch" 2 3 (face ido-hacks-flex-match) 7 8 (face ido-hacks-flex-match) 8 9 (face ido-hacks-flex-match) 9 10 (face ido-hacks-flex-match) 10 11 (face ido-hacks-flex-match)) Content-Disposition: inline; filename=0001-Fix-trap-handlers-to-handle-applicable-structs.patch Content-Transfer-Encoding: 8bit Content-Description: ,br fix >From 3a117b22b10c9577868fd22f88d1cad2e2ec32a0 Mon Sep 17 00:00:00 2001 From: Ian Price Date: Thu, 24 Oct 2013 05:51:47 +0100 Subject: [PATCH] Fix trap handlers to handle applicable structs. Reported by Jordy Dickinson . Fixes . * module/system/vm/traps.scm (frame-matcher): Extract procedure when proc is an applicable struct. --- module/system/vm/traps.scm | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/module/system/vm/traps.scm b/module/system/vm/traps.scm index cccd6ea..b65e034 100644 --- a/module/system/vm/traps.scm +++ b/module/system/vm/traps.scm @@ -109,15 +109,18 @@ ((new-disabled-trap vm enable disable) frame)) (define (frame-matcher proc match-objcode?) - (if match-objcode? - (lambda (frame) - (let ((frame-proc (frame-procedure frame))) - (or (eq? frame-proc proc) - (and (program? frame-proc) - (eq? (program-objcode frame-proc) - (program-objcode proc)))))) - (lambda (frame) - (eq? (frame-procedure frame) proc)))) + (let ((proc (if (struct? proc) + (procedure proc) + proc))) + (if match-objcode? + (lambda (frame) + (let ((frame-proc (frame-procedure frame))) + (or (eq? frame-proc proc) + (and (program? frame-proc) + (eq? (program-objcode frame-proc) + (program-objcode proc)))))) + (lambda (frame) + (eq? (frame-procedure frame) proc))))) ;; A basic trap, fires when a procedure is called. ;; -- 1.7.11.7 --=-=-=--