unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Rob Browning <rlb@defaultvalue.org>
To: 39395@debbugs.gnu.org
Subject: bug#39395: GOOPS generic promotion fails for nary functions
Date: Sun, 02 Feb 2020 13:04:42 -0600	[thread overview]
Message-ID: <87a7606cad.fsf@trouble.defaultvalue.org> (raw)


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





             reply	other threads:[~2020-02-02 19:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-02 19:04 Rob Browning [this message]
2020-02-07  6:39 ` bug#39395: GOOPS generic promotion fails for nary functions Rob Browning

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a7606cad.fsf@trouble.defaultvalue.org \
    --to=rlb@defaultvalue.org \
    --cc=39395@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).