Subject: define-generic doesn't promote equal? to generic

From: Rob Browning <[email-masked]>
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