From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jan Nieuwenhuizen Newsgroups: gmane.lisp.guile.user Subject: goops and equal? Date: Mon, 10 Nov 2014 13:57:56 +0100 Organization: AvatarAcademy.nl Message-ID: <87wq73ciwb.fsf@drakenvlieg.flower> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1415624314 27378 80.91.229.3 (10 Nov 2014 12:58:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 10 Nov 2014 12:58:34 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Nov 10 13:58:28 2014 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 1XnoY7-0002yL-In for guile-user@m.gmane.org; Mon, 10 Nov 2014 13:58:27 +0100 Original-Received: from localhost ([::1]:42755 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnoY7-0003Is-9N for guile-user@m.gmane.org; Mon, 10 Nov 2014 07:58:27 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47939) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnoXp-0003Aw-F8 for guile-user@gnu.org; Mon, 10 Nov 2014 07:58:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XnoXj-0007nk-BF for guile-user@gnu.org; Mon, 10 Nov 2014 07:58:09 -0500 Original-Received: from lb1-smtp-cloud2.xs4all.net ([194.109.24.21]:57834) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnoXj-0007nL-60 for guile-user@gnu.org; Mon, 10 Nov 2014 07:58:03 -0500 Original-Received: from drakenvlieg.flower.peder.onsbrabantnet.nl ([31.223.170.65]) by smtp-cloud2.xs4all.net with ESMTP id Doxw1p00K1R0Yaf01oy1o0; Mon, 10 Nov 2014 13:58:01 +0100 X-Url: http://AvatarAcademy.nl User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 194.109.24.21 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 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-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:11629 Archived-At: Hi, In the example below, my implementation of equal? is only being=20 used if both types are the same. That surprised me; the manual says equal? becomes a generic and for normal generics this works as I expect. How do I get the magic equal? to do what show the same result as the simple generic type-equal? And also, do we want such surprises? Greetings, Jan (read-set! keywords 'prefix) (use-modules (oop goops)) (define-class () (name :accessor .name :init-value #f :init-keyword :name)) (define-method (equal? (a ) (b )) (display "equal?\n") (eq? (.name a) (.name b))) (define-method (equal? (a ) (b )) (display "equal?\n") (eq? (.name a) b)) (define-method (type-equal? (a ) (b )) (display "equal?\n") (eq? (.name a) b)) (format #t "equal?: ~a\n" (equal? (make :name 'a) (make :name= 'a))) (newline) (format #t "equal?: ~a\n" (equal? (make :name 'a) 'a)) (newline) (format #t "type-equal?: ~a\n" (type-equal? (make :name 'a) 'a)) (newline) --=20 Jan Nieuwenhuizen | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.nl= =20=20