From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jan Wedekind Newsgroups: gmane.lisp.guile.user Subject: Re: Modules and GOOPS Date: Wed, 27 Jul 2016 20:44:04 +0100 (BST) Message-ID: References: Reply-To: Jan Wedekind NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1469648688 28242 80.91.229.3 (27 Jul 2016 19:44:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Jul 2016 19:44:48 +0000 (UTC) Cc: guile-user@gnu.org To: =?ISO-8859-15?Q?Kovacsics_R=F3bert?= Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Jul 27 21:44:39 2016 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bSUkw-00017B-Vx for guile-user@m.gmane.org; Wed, 27 Jul 2016 21:44:39 +0200 Original-Received: from localhost ([::1]:48352 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSUkv-0003VM-UE for guile-user@m.gmane.org; Wed, 27 Jul 2016 15:44:37 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSUkW-0003VF-SL for guile-user@gnu.org; Wed, 27 Jul 2016 15:44:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSUkR-0007mS-RI for guile-user@gnu.org; Wed, 27 Jul 2016 15:44:12 -0400 Original-Received: from basicbox4.server-home.net ([195.137.212.26]:54404) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSUkR-0007lN-Kt for guile-user@gnu.org; Wed, 27 Jul 2016 15:44:07 -0400 Original-Received: from wedemob.default (unknown [95.150.201.231]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by basicbox4.server-home.net (Postfix) with ESMTPSA id 3DE4F1530663; Wed, 27 Jul 2016 21:44:05 +0200 (CEST) X-X-Sender: jan@wedemob In-Reply-To: User-Agent: Alpine 2.11 (DEB 23 2013-08-11) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 195.137.212.26 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:12802 Archived-At: On Wed, 27 Jul 2016, Kovacsics R=C3=B3bert wrote: > 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: > > > ; =3D > (define-module (mbe a) > #:use-module (oop goops) > #:export ( x y)) > > (define-class ()) > > (define-generic x) > (define-generic y) > > (define-method (y (a )) > (display (x a))) > > ; =3D > (define-module (mbe b) > #:use-module (oop goops) > #:use-module (mbe a) > #:export ( x)) > > (define-class ()) > > (define-method (x (b )) > 'b) > > ; =3D > (define-module (mbe test) > #:use-module (oop goops) > #:use-module (mbe a) > #:use-module (mbe b) > #:duplicates (merge-generics)) > > (y (make )) > > > and when I type "(use-modules (mbe test))" in guile, I get > > > While compiling expression: > ERROR: No applicable method for #< x (0)> in call (x #< 23c= cdd0>) > > (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. > > Having mbe/b.scm *not* export "x" works but I am not sure whether that is= =20 the solution you are looking for: ; =3D (define-module (mbe a) #:use-module (oop goops) #:export ( x y)) (define-class ()) (define-generic x) (define-generic y) (define-method (y (a )) (display (x a))) ; =3D (define-module (mbe b) #:use-module (oop goops) #:use-module (mbe a) #:export ()) (define-class ()) (define-method (x (b )) 'b) ; =3D (define-module (mbe test) #:use-module (oop goops) #:use-module (mbe a) #:use-module (mbe b) #:duplicates (merge-generics)) (y (make )) Has anybody managed to get the "merge-generics" handler to work? I used t= o=20 have this in my $HOME/.guile configuration but it didn't seem to have any= =20 effect: (default-duplicate-binding-handler '(merge-generics replace warn-override= -core warn last))