From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: goops method defined only in derived classes fails to become generic? Date: Sat, 21 May 2011 18:41:21 +0200 Message-ID: References: <1296653688.19670.266.camel@vuurvlieg> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1305996104 3312 80.91.229.12 (21 May 2011 16:41:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 21 May 2011 16:41:44 +0000 (UTC) Cc: guile-devel To: Jan Nieuwenhuizen Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat May 21 18:41:37 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QNpF9-0008FH-To for guile-devel@m.gmane.org; Sat, 21 May 2011 18:41:36 +0200 Original-Received: from localhost ([::1]:45807 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNpF8-0003W2-UF for guile-devel@m.gmane.org; Sat, 21 May 2011 12:41:35 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:40682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNpF6-0003Vl-9l for guile-devel@gnu.org; Sat, 21 May 2011 12:41:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QNpF3-0008U4-Fy for guile-devel@gnu.org; Sat, 21 May 2011 12:41:32 -0400 Original-Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:45128 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QNpF3-0008Tu-D1; Sat, 21 May 2011 12:41:29 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 38C3D57B5; Sat, 21 May 2011 12:43:35 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=POhuRyLsICwsgwYhtwWzT+gq+lI=; b=LN8Ix7 YtRPm+gzbTB5VCmMhBlpDrCkXDTfA8LsgAPgdX/n51RLRq0Bm+yOgj1036TR8bqp bwY/41FGTEb7YYlrILZKA/xIFkDI44gwOcao7NCYtGLxzF2KcawpLrcGdmtDz8vX DwNO/fP8xmIq536uoVYEapU7O+rokLDQN7szM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=yD3573ZlgqP9S6A7EicZNlAwrN+cqLVa 8DkIX2eS773YKXWh82oLaoIYRTqsI73VrCpwL0208qa3Cf2XHqeGm2O91icT43fT VF18o3BjUvWcZaU9ismoyfX/kWJyh1GAO6yyw8FnEBXRBxeXcgEweb2NR8U6ch8S ZocSas4GWnk= Original-Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 2441357B0; Sat, 21 May 2011 12:43:34 -0400 (EDT) Original-Received: from unquote.localdomain (unknown [90.164.198.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id 5EF1E57AF; Sat, 21 May 2011 12:43:32 -0400 (EDT) In-Reply-To: <1296653688.19670.266.camel@vuurvlieg> (Jan Nieuwenhuizen's message of "Wed, 02 Feb 2011 14:34:48 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: 77AC2B18-83C9-11E0-BB9A-BBB7F5B2FB1A-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 64.74.157.62 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12522 Archived-At: Hi, On Wed 02 Feb 2011 14:34, Jan Nieuwenhuizen writes: > This worked with guile 1.8. Bug or feature? Bugs, bugs, bugs! The files were: > [5. text/x-scheme; base.scm]... > > (define-module (base) > #:use-module (oop goops) > #:export ( > func)) > > (define-class ()) > > (define-method (func (self )) > (format #t ": func\n")) > > [4. text/x-scheme; impl-a.scm]... > > (define-module (impl-a) > #:use-module (oop goops) > #:use-module (base) > #:export ( > func-impl) > #:re-export (func)) > > (define-class ()) > > (define-method (func (self )) > (format #t ": func\n")) > > (define-method (func-impl (self )) > (format #t ": func-impl\n")) > > [3. text/x-scheme; impl-b.scm]... > > (define-module (impl-b) > #:use-module (oop goops) > #:use-module (base) > #:export ( > func-impl) > #:re-export (func)) > > (define-class ()) > > (define-method (func (self )) > (format #t ": func\n")) > > (define-method (func-impl (self )) > (format #t ": func-impl\n")) Note that here we have a typo I think ( instead of ); this should not have worked in either, but it was working in 1.8 for a reason I will get to in a minute. > [2. text/x-scheme; use.scm]... > > #! /bin/sh > # -*- scheme -*- > exec guile --debug -L $(dirname $0) -s $0 "$@" > !# > > (use-modules > (oop goops) > (base) > (impl-a) > (impl-b) > ) > > (define obj (make )) > > (func obj) > > (func-impl obj) This works in 1.8 because use-modules apparently has a bug in which modules loaded from a use-modules form are loaded in reverse order. So the last binding wins, and it's the one from . For some reason the reference in the `func-impl' from impl-b.scm is never made; I suspect related to some lazy expansion strangeness. This bug is not present in 2.0. Now, if we fix the bug in impl-b.scm to refer to , in 2.0 the error is that `func-impl' does not apply to objects of type . OK, this is correct. However, if instead of using use-modules we use `define-module' with #:use-module forms, we meet a similar bug, in that 2.0's define-module imports the modules in reverse order, so we get the `func-impl' from impl-a.scm, which does "work"; but wrongly! Basically your test case had bugs, but they showed a very important bug in guile 2.0's define-module, and a previously unknown one from 1.8. I'm not going to fix 1.8, but I have fixed 2.0. Thanks for the report, Andy -- http://wingolog.org/