unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#47232: GOOPS cannot use generic as accessor in 3.0.x
@ 2021-03-18 13:19 Jan Nieuwenhuizen
  0 siblings, 0 replies; only message in thread
From: Jan Nieuwenhuizen @ 2021-03-18 13:19 UTC (permalink / raw)
  To: 47232

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

Hi!

Trying to upgrade 8sync to latest Guile, I found the problem that a
generic function cannot be used as as accessor, and then be
exported/imported.  Or something.  At least, the problem is triggered
when compiling (or using) a module that does that.

See the attached foo.scm, bar.scm and `doit', when running it in the
Guile source tree I get

--8<---------------cut here---------------start------------->8---
$ ./doit 
++ export GUILE_LOAD_COMPILED_PATH=/home/janneke/src/8sync/wip
++ GUILE_LOAD_COMPILED_PATH=/home/janneke/src/8sync/wip
++ ./pre-inst-env guild compile -L . -o foo.go foo.scm
wrote `foo.go'
++ ./pre-inst-env guild compile -L . -o bar.go bar.scm
Backtrace:
In ice-9/eval.scm:
   293:34 19 (_ #<module (#{ g79}#) 7ff689b8dd20>)
In ice-9/boot-9.scm:
   3380:4 18 (define-module* _ #:filename _ #:pure _ #:version _ #:imports _ #:exports _ #:replacements _ # _ # …)
  2565:24 17 (call-with-deferred-observers #<procedure 7ff689b948c0 at ice-9/boot-9.scm:3381:5 ()>)
  3393:24 16 (_)
   222:17 15 (map1 (((foo))))
  3297:17 14 (resolve-interface (foo) #:select _ #:hide _ #:prefix _ #:renamer _ #:version _)
In ice-9/threads.scm:
    390:8 13 (_ _)
In ice-9/boot-9.scm:
  3223:13 12 (_)
In ice-9/threads.scm:
    390:8 11 (_ _)
In ice-9/boot-9.scm:
  3507:20 10 (_)
   2806:4  9 (save-module-excursion #<procedure 7ff68aeece10 at ice-9/boot-9.scm:3508:21 ()>)
  3527:26  8 (_)
In unknown file:
           7 (primitive-load-path "foo" #<procedure 7ff689bb6140 at ice-9/boot-9.scm:3514:37 ()>)
In foo.scm:
     12:0  6 (_)
In oop/goops.scm:
   2852:4  5 (_ _ . _)
   2782:2  4 (_ #<<class> <foo> 7ff688c64f80> _)
In srfi/srfi-1.scm:
    634:9  3 (for-each #<procedure 7ff688c5c0c0 at oop/goops.scm:2579:3 (slot)> (#<<slot> foo 7ff688c64e80>))
In oop/goops.scm:
  2590:22  2 (_ #<<slot> foo 7ff688c64e80>)
In unknown file:
           1 (setter #<<generic> .foo (1)>)
In ice-9/boot-9.scm:
  1669:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1669:16: In procedure raise-exception:
In procedure setter: Wrong type argument in position 1: #<<generic> .foo (1)>
--8<---------------cut here---------------end--------------->8---

I found similar behaviour in guile-3.0.2, guile-2.2.7 is fine.

Greetings,
Janneke


[-- Attachment #2: doit --]
[-- Type: application/octet-stream, Size: 331 bytes --]

set -x

# We cannot use meta/build-env, that removes $PWD from GUILE_LOAD_*_PATH
export GUILE_LOAD_PATH=$PWD:$PWD/module
export GUILE_LOAD_COMPILED_PATH=$PWD:$PWD/module
export GUILE=$PWD/libguile/guile

# Also, "guild compile" lacks the -C flag
meta/guild compile -L . -o foo.go foo.scm
meta/guild compile -L . -o bar.go bar.scm 

[-- Attachment #3: foo.scm --]
[-- Type: application/octet-stream, Size: 160 bytes --]

(define-module (foo)
  #:use-module (oop goops)
  #:export (<foo>))

(define (foo)
  #t)
(define-generic .foo)

(define-class <foo> ()
  (foo #:accessor .foo))

[-- Attachment #4: bar.scm --]
[-- Type: application/octet-stream, Size: 64 bytes --]

(define-module (bar)
  #:use-module (foo))

(display "hello\n")

[-- Attachment #5: Type: text/plain, Size: 152 bytes --]


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-18 13:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18 13:19 bug#47232: GOOPS cannot use generic as accessor in 3.0.x Jan Nieuwenhuizen

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 NNTP newsgroup(s).