GNU bug report logs - #39395
GOOPS generic promotion fails for nary functions

Previous Next

Package: guile;

Reported by: Rob Browning <rlb <at> defaultvalue.org>

Date: Sun, 2 Feb 2020 19:05:01 UTC

Severity: normal

To reply to this bug, email your comments to 39395 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#39395; Package guile. (Sun, 02 Feb 2020 19:05:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Rob Browning <rlb <at> defaultvalue.org>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Sun, 02 Feb 2020 19:05:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rob Browning <rlb <at> defaultvalue.org>
To: bug-guile <at> gnu.org
Subject: GOOPS generic promotion fails for nary functions
Date: Sun, 02 Feb 2020 13:04:42 -0600
I noticed that this fails in (at least) 2.0, 2.2 and 3.0:

  (use-modules (oop goops))
  (define (foo . rest) 'fallback)
  (define-method (foo (x <string>)) <string>)

e.g.:

  $ guile-3.0 -s test.scm
  Backtrace:
  In ice-9/boot-9.scm:
    1736:10  6 (with-exception-handler _ _ #:unwind? _ # _)
  In unknown file:
             5 (apply-smob/0 #<thunk 558f3c1bbb80>)
  In ice-9/boot-9.scm:
      718:2  4 (call-with-prompt _ _ #<procedure default-prompt-handle?>)
  In ice-9/eval.scm:
      619:8  3 (_ #(#(#<directory (guile-user) 558f3c28bf00>)))
  In ice-9/boot-9.scm:
     2806:4  2 (save-module-excursion _)
    4351:12  1 (_)
  In oop/goops.scm:
     1585:2  0 (_ _ _)

And then I found that the the manual says this:

  If symbol was previously bound to a Scheme procedure (or
  procedure-with-setter), the old procedure (and setter) is incorporated
  into the new generic function as its default procedure (and setter).

So I wondered if this might be a bug, or was expected behavior.  It's
also easy to work around -- just change the first define to a
define-method.

Thanks
-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4




Information forwarded to bug-guile <at> gnu.org:
bug#39395; Package guile. (Fri, 07 Feb 2020 06:40:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rob Browning <rlb <at> defaultvalue.org>
To: bug-guile <at> gnu.org
Subject: Re: GOOPS generic promotion fails for nary functions
Date: Fri, 07 Feb 2020 00:39:15 -0600
Rob Browning <rlb <at> defaultvalue.org> writes:

> And then I found that the the manual says this:
>
>   If symbol was previously bound to a Scheme procedure (or
>   procedure-with-setter), the old procedure (and setter) is incorporated
>   into the new generic function as its default procedure (and setter).
>
> So I wondered if this might be a bug, or was expected behavior.  It's
> also easy to work around -- just change the first define to a
> define-method.

Not sure if this might be related.  With guile-3.0

  (use-modules (oop goops))
  (define x close)
  (define-generic x)

produces:

  $ guile-3.0 -s test.scm
  ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
  ;;;       or pass the --no-auto-compile argument to disable.
  ;;; compiling /home/rlb/test.scm
  ;;; /home/rlb/test.scm:5:0: warning: shadows previous definition of `x' at /home/rlb/test.scm:4:0
  ;;; compiled /home/rlb/.cache/guile/ccache/3.0-LE-8-4.2/home/rlb/test.scm.go

Thanks
-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4




This bug report was last modified 4 years and 88 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.