unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* implicitly using existing function as generic fails in 1.9
@ 2011-02-02 14:02 Jan Nieuwenhuizen
  2011-02-11 17:48 ` Andy Wingo
  2011-05-23 20:42 ` Andy Wingo
  0 siblings, 2 replies; 5+ messages in thread
From: Jan Nieuwenhuizen @ 2011-02-02 14:02 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 2464 bytes --]

Hi,

See attached code, run using

   ./run.scm

1.8 says:

    14:58:59 janneke@vuurvlieg:~/vc/schikkers-list/remove
    $ ./run.scm
    WARNING: (use): `remove!' imported from both (srfi srfi-1) and (remove)
    <class>: remove!

1.9.14 says:

14:58:36 janneke@vuurvlieg:~/vc/schikkers-list/remove
    $ rm -rf ~/.cache/guile/
    14:59:10 janneke@vuurvlieg:~/vc/schikkers-list/remove
    $ ./run.scm
    ;;; note: autocompilation is enabled, set GUILE_AUTO_COMPILE=0
    ;;;       or pass the --no-autocompile argument to disable.
    ;;; compiling ./run.scm
    ;;; compiling /home/janneke/vc/schikkers-list/remove/use.scm
    ;;; compiling /home/janneke/vc/schikkers-list/remove/remove.scm
    ;;; compiled /home/janneke/.cache/guile/ccache/2.0-0.T-LE-4/home/janneke/vc/schikkers-list/remove/remove.scm.go
    WARNING: (use): `remove!' imported from both (remove) and (srfi srfi-1)
    ;;; compiled /home/janneke/.cache/guile/ccache/2.0-0.T-LE-4/home/janneke/vc/schikkers-list/remove/use.scm.go
    ;;; compiled /home/janneke/.cache/guile/ccache/2.0-0.T-LE-4/home/janneke/vc/schikkers-list/remove/run.scm.go
    WARNING: (use): `remove!' imported from both (remove) and (srfi srfi-1)
    WARNING: (use): `remove!' imported from both (srfi srfi-1) and (remove)
    WARNING: (use): `remove!' imported from both (remove) and (srfi srfi-1)
    Backtrace:
    In module/ice-9/boot-9.scm:
     170: 9 [catch #t #<catch-closure 86525a0> ...]
    In unknown file:
       ?: 8 [catch-closure]
    In module/ice-9/boot-9.scm:
      62: 7 [call-with-prompt prompt0 ...]
    In module/ice-9/eval.scm:
     389: 6 [eval # #]
    In module/ice-9/boot-9.scm:
    1864: 5 [save-module-excursion #<procedure 8660b88 at module/ice-9/boot-9.scm:1878:3 ()>]
    1172: 4 [load "./run.scm" #f]
    In unknown file:
       ?: 3 [load-compiled/vm "/home/janneke/.cache/guile/ccache/2.0-0.T-LE-4/home/janneke/vc/schikkers-list/remove/run.scm.go"]
       ?: 2 [remove! #<<cls> 8b36380>]
    In module/ice-9/boot-9.scm:
     115: 1 [#<procedure 85c64d8 at module/ice-9/boot-9.scm:110:6 (thrown-k . args)> wrong-number-of-args ...]
    In unknown file:
       ?: 0 [catch-closure wrong-number-of-args #f ...]

    ERROR: In procedure catch-closure:
    ERROR: Wrong number of arguments to #<procedure remove! (_ _)>
    [1]14:59:12 janneke@vuurvlieg:~/vc/schikkers-list/remove
    $ 

I haven't found the fix or workaround other than renaming the method to
`xremove!'.

Greetings,
Jan.


[-- Attachment #2: remove.tar.gz --]
[-- Type: application/x-compressed-tar, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: implicitly using existing function as generic fails in 1.9
  2011-02-02 14:02 implicitly using existing function as generic fails in 1.9 Jan Nieuwenhuizen
@ 2011-02-11 17:48 ` Andy Wingo
  2011-02-11 18:53   ` Jan Nieuwenhuizen
  2011-05-23 20:42 ` Andy Wingo
  1 sibling, 1 reply; 5+ messages in thread
From: Andy Wingo @ 2011-02-11 17:48 UTC (permalink / raw)
  To: Jan Nieuwenhuizen; +Cc: guile-devel

On Wed 02 Feb 2011 15:02, Jan Nieuwenhuizen <janneke-list@xs4all.nl> writes:

>     WARNING: (use): `remove!' imported from both (remove) and (srfi srfi-1)

As far as I can tell, it never worked to merge generics between a
regular procedure and a generic.  So the only way that your remove! case
could have worked would be to have the define-method create a generic
that fell back to the old value; but that does not appear to work:

  scheme@(guile-user)> (define-method (remove! (s <symbol>)) (pk 'hey))
  ERROR: In procedure scm-error:
  ERROR: #<procedure remove! (_ _)> is not a valid generic function

And indeed that does not appear to work with 1.8.

I don't understand what's going on here, really.  Do you?

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: implicitly using existing function as generic fails in 1.9
  2011-02-11 17:48 ` Andy Wingo
@ 2011-02-11 18:53   ` Jan Nieuwenhuizen
  2011-02-12 10:32     ` Andy Wingo
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Nieuwenhuizen @ 2011-02-11 18:53 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guile-devel

[-- Attachment #1: Type: text/plain, Size: 1009 bytes --]

Andy Wingo schreef op vr 11-02-2011 om 18:48 [+0100]:
> On Wed 02 Feb 2011 15:02, Jan Nieuwenhuizen <janneke-list@xs4all.nl> writes:
> 
> >     WARNING: (use): `remove!' imported from both (remove) and (srfi srfi-1)
> 
> As far as I can tell, it never worked to merge generics between a
> regular procedure and a generic.

> And indeed that does not appear to work with 1.8.

I'm attaching the individual files; this works with 1.8.7:

    19:52:20 janneke@vuurvlieg:~/vc/schikkers-list/remove
    $ ./run.scm 
    WARNING: (use): `remove!' imported from both (srfi srfi-1) and (remove)
    <class>: remove!
    19:52:24 janneke@vuurvlieg:~/vc/schikkers-list/remove

> I don't understand what's going on here, really.  Do you?

No, and if you say it's not supported, I'll just have to
choose other names for those functions.

Jan.

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  

[-- Attachment #2: use.scm --]
[-- Type: text/x-scheme, Size: 180 bytes --]

(define-module (use)
  #:use-module (oop goops)
  #:use-module (srfi srfi-1)
  #:use-module (remove)
  #:export (main))

(define obj (make <cls>))

(define (main)
  (remove! obj))

[-- Attachment #3: run.scm --]
[-- Type: text/x-scheme, Size: 122 bytes --]

#! /bin/sh
# -*- scheme -*-
exec guile --debug -L $(dirname $0) -s $0 "$@"
!#

;;(use-modules
;; (use))

((@ (use) main))

[-- Attachment #4: remove.scm --]
[-- Type: text/x-scheme, Size: 246 bytes --]


(define-module (remove)
  #:use-module (oop goops)
  #:use-module (srfi srfi-1)
  #:duplicates (merge-generics)
  #:export (<cls>
	    remove!))

(define-class <cls> ())

(define-method (remove! (self <cls>))
  (format #t "<class>: remove!\n"))

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: implicitly using existing function as generic fails in 1.9
  2011-02-11 18:53   ` Jan Nieuwenhuizen
@ 2011-02-12 10:32     ` Andy Wingo
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Wingo @ 2011-02-12 10:32 UTC (permalink / raw)
  To: Jan Nieuwenhuizen; +Cc: guile-devel

On Fri 11 Feb 2011 19:53, Jan Nieuwenhuizen <janneke-list@xs4all.nl> writes:

> I'm attaching the individual files; this works with 1.8.7:

Right, I saw your files, and they do work with 1.8.7; I was just trying
to figure out what the difference is.  I suspect it's merge-generics
related.

>> I don't understand what's going on here, really.  Do you?
>
> No, and if you say it's not supported, I'll just have to
> choose other names for those functions.

No, I think you've found a bug here, please don't give up so easily :)

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: implicitly using existing function as generic fails in 1.9
  2011-02-02 14:02 implicitly using existing function as generic fails in 1.9 Jan Nieuwenhuizen
  2011-02-11 17:48 ` Andy Wingo
@ 2011-05-23 20:42 ` Andy Wingo
  1 sibling, 0 replies; 5+ messages in thread
From: Andy Wingo @ 2011-05-23 20:42 UTC (permalink / raw)
  To: Jan Nieuwenhuizen; +Cc: guile-devel

On Wed 02 Feb 2011 15:02, Jan Nieuwenhuizen <janneke-list@xs4all.nl> writes:

> Hi,
>
> See attached code, run using
>
>    ./run.scm
>
> 1.8 says:
>
>     14:58:59 janneke@vuurvlieg:~/vc/schikkers-list/remove
>     $ ./run.scm
>     WARNING: (use): `remove!' imported from both (srfi srfi-1) and (remove)
>     <class>: remove!
>
> 1.9.14 says:
>
> 14:58:36 janneke@vuurvlieg:~/vc/schikkers-list/remove
>     $ rm -rf ~/.cache/guile/
>     14:59:10 janneke@vuurvlieg:~/vc/schikkers-list/remove
>     $ ./run.scm
>     ;;; note: autocompilation is enabled, set GUILE_AUTO_COMPILE=0
>     ;;;       or pass the --no-autocompile argument to disable.
>     ;;; compiling ./run.scm
>     ;;; compiling /home/janneke/vc/schikkers-list/remove/use.scm
>     ;;; compiling /home/janneke/vc/schikkers-list/remove/remove.scm
>     ;;; compiled /home/janneke/.cache/guile/ccache/2.0-0.T-LE-4/home/janneke/vc/schikkers-list/remove/remove.scm.go
>     WARNING: (use): `remove!' imported from both (remove) and (srfi srfi-1)
>     ;;; compiled /home/janneke/.cache/guile/ccache/2.0-0.T-LE-4/home/janneke/vc/schikkers-list/remove/use.scm.go
>     ;;; compiled /home/janneke/.cache/guile/ccache/2.0-0.T-LE-4/home/janneke/vc/schikkers-list/remove/run.scm.go
>     WARNING: (use): `remove!' imported from both (remove) and (srfi srfi-1)
>     WARNING: (use): `remove!' imported from both (srfi srfi-1) and (remove)
>     WARNING: (use): `remove!' imported from both (remove) and (srfi srfi-1)
>     Backtrace:
>     In module/ice-9/boot-9.scm:
>      170: 9 [catch #t #<catch-closure 86525a0> ...]
>     In unknown file:
>        ?: 8 [catch-closure]
>     In module/ice-9/boot-9.scm:
>       62: 7 [call-with-prompt prompt0 ...]
>     In module/ice-9/eval.scm:
>      389: 6 [eval # #]
>     In module/ice-9/boot-9.scm:
>     1864: 5 [save-module-excursion #<procedure 8660b88 at module/ice-9/boot-9.scm:1878:3 ()>]
>     1172: 4 [load "./run.scm" #f]
>     In unknown file:
>        ?: 3 [load-compiled/vm "/home/janneke/.cache/guile/ccache/2.0-0.T-LE-4/home/janneke/vc/schikkers-list/remove/run.scm.go"]
>        ?: 2 [remove! #<<cls> 8b36380>]
>     In module/ice-9/boot-9.scm:
>      115: 1 [#<procedure 85c64d8 at module/ice-9/boot-9.scm:110:6 (thrown-k . args)> wrong-number-of-args ...]
>     In unknown file:
>        ?: 0 [catch-closure wrong-number-of-args #f ...]
>
>     ERROR: In procedure catch-closure:
>     ERROR: Wrong number of arguments to #<procedure remove! (_ _)>

Happily this is the same bug I fixed a couple days ago.

   $ /opt/guile/env ./run.scm 
   ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
   ;;;       or pass the --no-auto-compile argument to disable.
   ;;; compiling /tmp/remove/run.scm
   ;;; compiling /tmp/remove/use.scm
   ;;; compiling /tmp/remove/remove.scm
   ;;; compiled /home/wingo/.cache/guile/ccache/2.0-LE-8-2.0/tmp/remove/remove.scm.go
   WARNING: (use): `remove!' imported from both (srfi srfi-1) and (remove)
   ;;; compiled /home/wingo/.cache/guile/ccache/2.0-LE-8-2.0/tmp/remove/use.scm.go
   ;;; compiled /home/wingo/.cache/guile/ccache/2.0-LE-8-2.0/tmp/remove/run.scm.go
   WARNING: (use): `remove!' imported from both (srfi srfi-1) and (remove)
   <class>: remove!

Cheers,

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-05-23 20:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-02 14:02 implicitly using existing function as generic fails in 1.9 Jan Nieuwenhuizen
2011-02-11 17:48 ` Andy Wingo
2011-02-11 18:53   ` Jan Nieuwenhuizen
2011-02-12 10:32     ` Andy Wingo
2011-05-23 20:42 ` Andy Wingo

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).