GNU bug report logs - #37461
Methods added to primitive generics don't always work

Previous Next

Package: guile;

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

Date: Thu, 19 Sep 2019 15:38:02 UTC

Severity: normal

Found in version 2.2.6

Full log


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: define-generic doesn't promote equal? to generic
Date: Thu, 19 Sep 2019 10:37:54 -0500
Version: 2.2.6

  scheme@(guile-user)> (use-modules (oop goops))
  scheme@(guile-user)> equal?
  $1 = #<procedure equal? (#:optional _ _ . _)>
  scheme@(guile-user)> (define-generic equal?)
  scheme@(guile-user)> equal?
  $2 = #<procedure equal? (#:optional _ _ . _)>

The same appears to be true for other primitives like + too, but if I'm
reading it right, this makes it sound like it was intended to work:

  https://www.gnu.org/software/guile/docs/master/guile.html/Extending-Primitives.html

You can work around the problem by stashing equal? somewhere else, and
then define-generic will work after a (define equal? #f).  Presumably
you'd then need to define a base specialization using the original
equal? or do something equivalent.

I also noticed goops itself does this: https://git.savannah.gnu.org/gitweb/?p=guile.git;a=blob;f=module/oop/goops.scm;h=837a667e602\
5b6f8ed7818e5a8efe064cca7843d;hb=791cae940afcb2b2eb2c167fe438be1dc1008a73#l2335

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 5 years and 260 days ago.

Previous Next


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