unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: "Kovacsics Róbert" <kovirobi@gmail.com>
To: guile-user@gnu.org
Subject: Modules and GOOPS
Date: Wed, 27 Jul 2016 18:53:47 +0100	[thread overview]
Message-ID: <CABPkNKmRUQ2WhdZoJgkxSquMSVVQRLEQ5WXEsnx0gKVbA4ArvA@mail.gmail.com> (raw)

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	other threads:[~2016-07-27 17:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-27 17:53 Kovacsics Róbert [this message]
2016-07-27 19:44 ` Modules and GOOPS 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABPkNKmRUQ2WhdZoJgkxSquMSVVQRLEQ5WXEsnx0gKVbA4ArvA@mail.gmail.com \
    --to=kovirobi@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).