From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Thompson, David" Newsgroups: gmane.lisp.guile.bugs Subject: bug#58297: GOOPS slot accessor specialization and inheritance do not compose Date: Tue, 4 Oct 2022 20:21:51 -0400 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9946"; mail-complaints-to="usenet@ciao.gmane.io" To: 58297@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Wed Oct 05 02:23:24 2022 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ofsC3-0002MK-T8 for guile-bugs@m.gmane-mx.org; Wed, 05 Oct 2022 02:23:24 +0200 Original-Received: from localhost ([::1]:60456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofsC1-00072O-Sf for guile-bugs@m.gmane-mx.org; Tue, 04 Oct 2022 20:23:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofsBi-00071k-H6 for bug-guile@gnu.org; Tue, 04 Oct 2022 20:23:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56355) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ofsBi-0003ae-6x for bug-guile@gnu.org; Tue, 04 Oct 2022 20:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ofsBi-0004YW-1b for bug-guile@gnu.org; Tue, 04 Oct 2022 20:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Thompson, David" Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Wed, 05 Oct 2022 00:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58297 X-GNU-PR-Package: guile X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166492933517445 (code B ref -1); Wed, 05 Oct 2022 00:23:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 5 Oct 2022 00:22:15 +0000 Original-Received: from localhost ([127.0.0.1]:55433 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ofsAw-0004XJ-Vm for submit@debbugs.gnu.org; Tue, 04 Oct 2022 20:22:15 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:56122) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ofsAs-0004X7-4C for submit@debbugs.gnu.org; Tue, 04 Oct 2022 20:22:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53940) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofsAr-0006p2-RE for bug-guile@gnu.org; Tue, 04 Oct 2022 20:22:10 -0400 Original-Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]:47087) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ofsAp-0003VT-AE for bug-guile@gnu.org; Tue, 04 Oct 2022 20:22:09 -0400 Original-Received: by mail-lj1-x229.google.com with SMTP id p5so17040703ljc.13 for ; Tue, 04 Oct 2022 17:22:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=worcester-edu.20210112.gappssmtp.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date; bh=7rxrv6a6ElL9QhD5uplGlU+9B43834F/EX9b6IAZWrQ=; b=RQVtqKnfEOVIm4KfmXs+XSK0pA5u3Gd8vKh01mT23gg3etWm+zYSkbw5arJDCwDuGu K5QyEKHgEM5Hf/MwtqJmR/eXXsle4pwC+jarH9TgvuQ/aTVw5Ap94xNzdUud3GH6qpoF kLuY5LsRdQjWcHDIEcg9yAV8D11m8AaPv9pdiSio9Qj6ZPxJcXd+oNPRsRwmIscsKaB9 vq+0DHzpvuGxLeO7g6NxWWfbUlpkbdiudkmQTBVadsvNmeLILAgRQNkVZRfsypMGi0ZK jnJEgK4enChWLDGlCJceNsP2sImVQNvwbHTdP6SGhhRfFtz++gXGKV1zFpMPM9eoduNS uRhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date; bh=7rxrv6a6ElL9QhD5uplGlU+9B43834F/EX9b6IAZWrQ=; b=KCAIjZGgx78Nc0zaSuX7CV6Sba51G9uxwGDkx0zfgmdjtABYD0BnMTbpduTGVvPdCQ UngL79RQVKZQZa1fC6/t25kRgsCWEUJeP4Xt/wlww//fpycpOg80y4dAyXFVdih8EVso n0QqXCgcIs4S5hBcNaxYDsiT/vlzBRqRghBW2DQ8Wj1TtesQqecY32rEq0rjT71Mc2Je p6XAhkKf8O6SScGTsEZ3NIS0kQh1/wVI2lq5qBucwRb+dmsLIHmt8n/Q9AHIAoKREU/2 3vgtjjpXndSSlcJfxMijy57voqTD58WIlW0xxtRHp0yWa/Dit6jQzSWGF6VJZxzecO6P CtiQ== X-Gm-Message-State: ACrzQf2/Zf2qXQQAWw0jgaRKhETSQdMAc3xrB8JeOityPYc9uldfZb07 vgRwq2aYpbn7wCezJ/LdFIDrTbqFFMYtyRdnM7Z7PCirHtQylg== X-Google-Smtp-Source: AMsMyM7qCo5xTKJTVqezJsiuTypyPzlG9o1ed0xU2XG3JpExFocgi+nmNtrBS/czz9fsBt82KtrCLP6Hq4JZbKIqIc4= X-Received: by 2002:a2e:584:0:b0:26d:d9f6:3d91 with SMTP id 126-20020a2e0584000000b0026dd9f63d91mr4615938ljf.475.1664929322760; Tue, 04 Oct 2022 17:22:02 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::229; envelope-from=dthompson2@worcester.edu; helo=mail-lj1-x229.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.io gmane.lisp.guile.bugs:10395 Archived-At: In Guile, slot accessor specialization and inheritance do not compose. For example, you can't specialize an accessor's setter for a parent class and have it apply to a child class. Every child class defines new slot accessor methods. which means that the specialized parent methods will not be called since the new methods take precedence. The code below demonstrates the issue: (use-modules (oop goops)) (define-class () (name #:init-keyword #:name #:accessor name)) (define-method ((setter name) (person ) new-name) (display "renaming!\n") (slot-set! person 'name new-name)) (define-class ()) (define p1 (make #:name "Alice")) (define p2 (make #:name "Bob")) ;; Only the first set! call uses the specialized setter method defined ;; above. (set! (name p1) "Ada") (set! (name p2) "Ben") I would have expected the specialized setter method to apply to both and since does not shadow the 'name' slot. I compared this behavior with that of Common Lisp and found that CLOS does not clobber the method from the parent class, as demonstrated by this example program that I tested with SBCL: (defclass person () ((name :initarg :name :accessor name))) (defmethod (setf name) (new-name (obj person)) (format t "renaming!~&") (setf (slot-value obj 'name) new-name)) (defclass child (person) ()) (defvar p1 (make-instance 'person :name "Alice")) (defvar p2 (make-instance 'child :name "Bob")) ;; Both of these setf calls use the specialized setf method defined ;; above. (setf (name p1) "Ada") (setf (name p2) "Ben") I find the Common Lisp behavior much more desirable. Is this a bug or intended behavior? Thanks for reading, - Dave