GNU bug report logs - #24286
Guile-2.2: srfi-1 + #:duplicates (merge-generics...) + for-each raises an exception

Previous Next

Package: guile;

Reported by: David Pirotte <david <at> altosw.be>

Date: Mon, 22 Aug 2016 01:05:02 UTC

Severity: normal

Done: Andy Wingo <wingo <at> pobox.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24286 in the body.
You can then email your comments to 24286 AT debbugs.gnu.org in the normal way.

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#24286; Package guile. (Mon, 22 Aug 2016 01:05:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to David Pirotte <david <at> altosw.be>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Mon, 22 Aug 2016 01:05:02 GMT) Full text and rfc822 format available.

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

From: David Pirotte <david <at> altosw.be>
To: <bug-guile <at> gnu.org>
Subject: Guile-2.2: srfi-1 + #:duplicates (merge-generics...) + for-each
 raises an exception
Date: Sun, 21 Aug 2016 22:03:33 -0300
[Message part 1 (text/plain, inline)]
Hello Guilers,
Hi Andy,

Here below a mini module [1], which raises an exception [2] using 2.1.3.104-8f2f8 (it
compiles fine using 2.0.12).  It looks a bit of a 'silly' module but the real one
here do need this combination, I just minimized it for tracking purposes...

For info, if I either comment the use of srfi-1, or merge-generics, _or_ the for-each
expression, it compiles fine. I also tried foo to just do a (filter-map string?
words) and no for-each, to circumvent the problem as far as I could, and it
compiles fie as well: it appears there is a side effect of the for-each version from
srfi-1 over the core version, when using goops and declaring #:duplicates
(merge-generics ...).

Cheers,
David

[1]

(define-module (foo)
  #:use-module (srfi srfi-1)
  #:use-module (oop goops)
  
  #:duplicates (merge-generics
		replace
		warn-override-core
		warn
		last)
 
  #:export (foo))

(define (foo words)
  (for-each (lambda (word)
	      (display (string-append word " ")))
      words)
  (newline))

[2]

guild --version
guild (GNU Guile) 2.1.3.104-8f2f8

guild compile foo.scm
Backtrace:
In system/base/compile.scm:
     43:4 19 (call-once _)
In ice-9/boot-9.scm:
    829:4 18 (with-throw-handler _ _ _)
In system/base/compile.scm:
    59:11 17 (_)
   155:11 16 (_ #<closed: file 2067e00>)
   235:18 15 (read-and-compile #<input: foo.scm 13> #:from _ #:to _ # …)
   183:32 14 (compile-fold (#<procedure compile-tree-il (x e opts)>) …)
In ice-9/boot-9.scm:
   2325:4 13 (save-module-excursion #<procedure 1e09ba0 at language/…>)
In language/scheme/compile-tree-il.scm:
    31:15 12 (_)
In ice-9/psyntax.scm:
  1208:22 11 (expand-top-sequence ((define (foo words) (# (…) #) #)) …)
In ice-9/boot-9.scm:
   224:17 10 (map1 (#<procedure 205db90 at ice-9/psyntax.scm:1125:3…>))
In ice-9/psyntax.scm:
  1383:12  9 (_)
  1763:11  8 (lp (#(syntax-object (for-each (lambda (#) #) #) # …) …) …)
  1586:33  7 (parse (((("placeholder" placeholder) (# . #) …) . #) …) …)
  1307:27  6 (syntax-type (for-each (lambda (word) (display #)) #) # …)
  1291:39  5 (syntax-type for-each (("placeholder" placeholder) # #) …)
   302:24  4 (resolve-identifier _ _ (("placeholder" placeholder) …) …)
In unknown file:
           3 (module-variable #<directory (foo) 20c4bd0> for-each)
In oop/goops.scm:
   1437:4  2 (cache-miss #<directory (foo) 20c4bd0> for-each #<inte…> …)
In unknown file:
           1 (scm-error goops-error #f "No applicable method for ~S…" …)
In ice-9/boot-9.scm:
   753:26  0 (dispatch-exception _ _ _)

ice-9/boot-9.scm:753:26: In procedure dispatch-exception:
ice-9/boot-9.scm:753:26: No applicable method for #<<generic> merge-generics (3)> in
call (merge-generics #<directory (foo) 20c4bd0> for-each #<interface (guile)
1e02ea0> #<procedure for-each (f l) | (f l1 l2) | (f l1 . rest)> #<interface (srfi
1e02ea0> srfi-1) 1e4ca20> #<procedure for-each (f l) | (f l1 l2) | (f l1 . rest)> #f
1e02ea0> #f)
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to bug-guile <at> gnu.org:
bug#24286; Package guile. (Fri, 02 Sep 2016 07:31:02 GMT) Full text and rfc822 format available.

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

From: Andy Wingo <wingo <at> pobox.com>
To: David Pirotte <david <at> altosw.be>
Cc: 24286 <at> debbugs.gnu.org
Subject: Re: bug#24286: Guile-2.2: srfi-1 + #:duplicates (merge-generics...) +
 for-each raises an exception
Date: Fri, 02 Sep 2016 09:30:10 +0200
On Mon 22 Aug 2016 03:03, David Pirotte <david <at> altosw.be> writes:

> Hello Guilers,
> Hi Andy,
>
> Here below a mini module [1], which raises an exception [2] using 2.1.3.104-8f2f8 (it
> compiles fine using 2.0.12).  It looks a bit of a 'silly' module but the real one
> here do need this combination, I just minimized it for tracking purposes...
>
> For info, if I either comment the use of srfi-1, or merge-generics, _or_ the for-each
> expression, it compiles fine. I also tried foo to just do a (filter-map string?
> words) and no for-each, to circumvent the problem as far as I could, and it
> compiles fie as well: it appears there is a side effect of the for-each version from
> srfi-1 over the core version, when using goops and declaring #:duplicates
> (merge-generics ...).
>
> Cheers,
> David
>
> [1]
>
> (define-module (foo)
>   #:use-module (srfi srfi-1)
>   #:use-module (oop goops)
>   
>   #:duplicates (merge-generics
> 		replace
> 		warn-override-core
> 		warn
> 		last)

So here you are importing two definitions of for-each: one from (guile)
and one from (srfi srfi-1).  They are both normal procedures.  What
should happen?  I guess merge-generics should fail to do anything.  I
suppose that is the intention of this method in (oop goops):

  (define-method (merge-generics (module <module>)
                                 (name <symbol>)
                                 (int1 <module>)
                                 (val1 <top>)
                                 (int2 <module>)
                                 (val2 <top>)
                                 (var <top>)
                                 (val <top>))
    #f)

And yet you get:

  ERROR: No applicable method for #<<generic> merge-generics (3)> in call (merge-generics #<directory (foo) 204c480> for-each #<interface (guile) 20f1ea0> #<procedure for-each (f l) | (f l1 l2) | (f l1 . rest)> #<interface (srfi srfi-1) 21322d0> #<procedure for-each (f l) | (f l1 l2) | (f l1 . rest)> #f #f)

This sounds like a bug to me, surely the method should match.

On the other hand this looks bogus to me:

  scheme@(foo)> (class-of (resolve-interface '(guile)))
  $4 = #<<class> <module> 244bbd0>
  scheme@(foo)> (class-of (resolve-interface '(guile)))
  $5 = #<<class> <module> 244b900>

Why are we getting two distinct values for the class?  Further
investigation necessary.

Andy




Reply sent to Andy Wingo <wingo <at> pobox.com>:
You have taken responsibility. (Fri, 02 Sep 2016 07:45:02 GMT) Full text and rfc822 format available.

Notification sent to David Pirotte <david <at> altosw.be>:
bug acknowledged by developer. (Fri, 02 Sep 2016 07:45:02 GMT) Full text and rfc822 format available.

Message #13 received at 24286-done <at> debbugs.gnu.org (full text, mbox):

From: Andy Wingo <wingo <at> pobox.com>
To: David Pirotte <david <at> altosw.be>
Cc: 24286-done <at> debbugs.gnu.org
Subject: Re: bug#24286: Guile-2.2: srfi-1 + #:duplicates (merge-generics...) +
 for-each raises an exception
Date: Fri, 02 Sep 2016 09:44:36 +0200
On Mon 22 Aug 2016 03:03, David Pirotte <david <at> altosw.be> writes:

> Here below a mini module [1], which raises an exception [2] using 2.1.3.104-8f2f8 (it
> compiles fine using 2.0.12).  It looks a bit of a 'silly' module but the real one
> here do need this combination, I just minimized it for tracking purposes...

Thanks for the report, it was a nice bug.  Fixed in master.

Cheers,

Andy




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 30 Sep 2016 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 266 days ago.

Previous Next


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