unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Christopher Allan Webber <cwebber@dustycloud.org>
To: 23404@debbugs.gnu.org
Subject: bug#23404: Infinite recursion in GOOPS in Guile 2.2
Date: Fri, 29 Apr 2016 19:27:56 -0500	[thread overview]
Message-ID: <87wpngx7n7.fsf@dustycloud.org> (raw)

Heya all,

So I've been building something with GOOPS, and I decided to try it out
with Guile 2.2.  Unfortunately, I hit a pretty nasty bug.  You can try
it yourself... the code is pretty short:

  (use-modules (oop goops)
               (srfi srfi-9))
  (define-class <some-class> ())
  (define-method (time-to-break (some-class <some-class>) not-a-class)
    (display "We're never going home are we?\n"))

  ;; And now, call it
  (time-to-break (make <some-class>) 1)

This will loop forever and *never* complete.  Why?

Turns out this is why, from goops.scm:

  (define (single-arity-cache-dispatch cache nargs cache-miss)
    (match cache
      (() cache-miss)
      (((typev . cmethod) . cache)
       (cond
        ((eqv? nargs (vector-length typev))
         (let ((cache-miss (single-arity-cache-dispatch cache nargs cache-miss)))

I'm not sure what was supposed to happen (presumably the cache was
supposed to be narrowed down somehow), but what happens here is that
single-arity-cache-dispatch keeps calling single-arity-cache-dispatch
forever.

scheme@(guile-user) [1]> ,bt
In oop/goops.scm:
   1437:41939 (cache-miss #<<hive> e8a1e0> #<<message> id: "5c787e65bbeb34b27ffd16eead286fc6:1" to: ("8394701db8…>)
   1486:41938 (memoize-effective-method! _ _ _)
  1466:131937 (recompute-generic-function-dispatch-procedure! #<<generic> hive-process-message (1)>)
  1452:161936 (compute-generic-function-dispatch-procedure _)
  1378:251935 (single-arity-cache-dispatch _ 2 _)
  1378:251934 (single-arity-cache-dispatch _ 2 _)
  1378:251933 (single-arity-cache-dispatch _ 2 _)
  1378:251932 (single-arity-cache-dispatch _ 2 _)
  1378:251931 (single-arity-cache-dispatch _ 2 _)
  1378:251930 (single-arity-cache-dispatch _ 2 _)
  1378:251929 (single-arity-cache-dispatch _ 2 _)
  1378:251928 (single-arity-cache-dispatch _ 2 _)
  1378:251927 (single-arity-cache-dispatch _ 2 _)
  1378:251926 (single-arity-cache-dispatch _ 2 _)
  1378:251925 (single-arity-cache-dispatch _ 2 _)
  1378:251924 (single-arity-cache-dispatch _ 2 _)
  ... etc ...

(g?)Oops!

 - Chris





             reply	other threads:[~2016-04-30  0:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-30  0:27 Christopher Allan Webber [this message]
2016-04-30  2:26 ` bug#23404: Infinite recursion in GOOPS in Guile 2.2 Christopher Allan Webber
2016-04-30  2:27 ` Christopher Allan Webber
2017-02-28 15:12   ` Andy Wingo

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=87wpngx7n7.fsf@dustycloud.org \
    --to=cwebber@dustycloud.org \
    --cc=23404@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).