unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Modules and GOOPS
@ 2016-07-27 17:53 Kovacsics Róbert
  2016-07-27 19:44 ` Jan Wedekind
  2016-07-28 21:14 ` David Pirotte
  0 siblings, 2 replies; 11+ messages in thread
From: Kovacsics Róbert @ 2016-07-27 17:53 UTC (permalink / raw)
  To: guile-user

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.



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

end of thread, other threads:[~2016-07-31 16:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-27 17:53 Modules and GOOPS Kovacsics Róbert
2016-07-27 19:44 ` Jan Wedekind
2016-07-28 22:36   ` David Pirotte
2016-07-28 21:14 ` David Pirotte
2016-07-29  5:17   ` David Pirotte
2016-07-29 17:00   ` Kovacsics Róbert
2016-07-29 18:00     ` Marko Rauhamaa
2016-07-31  3:59       ` David Pirotte
2016-07-31 10:44       ` Chris Vine
2016-07-31 16:38         ` Marko Rauhamaa
2016-07-31  2:35     ` David Pirotte

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