guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Modules and GOOPS


From: Kovacsics Róbert
Subject: Modules and GOOPS
Date: Wed, 27 Jul 2016 18:53:47 +0100

Hello!

I have trouble with getting GOOPS and modules to co-operate. What I am
trying to do is to have 'A subclass B' where A is something akin to an
abstract class, that is it has generic "x" for which it provides no
implementation. This is my minimum broken example:


; <mbe/a.scm>=
(define-module (mbe a)
  #:use-module (oop goops)
  #:export (<a> x y))

(define-class <a> ())

(define-generic x)
(define-generic y)

(define-method (y (a <a>))
  (display (x a)))

; <mbe/b.scm>=
(define-module (mbe b)
  #:use-module (oop goops)
  #:use-module (mbe a)
  #:export (<b> x))

(define-class <b> (<a>))

(define-method (x (b <b>))
  'b)

; <mbe/test.scm>=
(define-module (mbe test)
  #:use-module (oop goops)
  #:use-module (mbe a)
  #:use-module (mbe b)
  #:duplicates (merge-generics))

(y (make <b>))


and when I type "(use-modules (mbe test))" in guile, I get


While compiling expression:
ERROR: No applicable method for #<<generic> x (0)> in call (x #<<b> 23ccdd0>)

(which shows that the generic function "x" has no implementation as
far as I can work it out, due to accessibility. When I don't use
separate modules, it works.)

Am I using the right sort of approach? I was thinking modules, for
extensibility.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]