From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mario Lang Newsgroups: gmane.emacs.devel Subject: Re: EIEIO default constructor function Date: Sun, 04 Apr 2021 10:39:42 +0200 Message-ID: <87k0pi30kx.fsf@blind.guru> References: <87y2e0rppp.fsf@blind.guru> <87ft06bwip.fsf@blind.guru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13773"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Apr 04 10:41:07 2021 Return-path: Envelope-to: ged-emacs-devel@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 1lSyJf-0003VJ-Im for ged-emacs-devel@m.gmane-mx.org; Sun, 04 Apr 2021 10:41:07 +0200 Original-Received: from localhost ([::1]:43576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lSyJe-00020L-Ky for ged-emacs-devel@m.gmane-mx.org; Sun, 04 Apr 2021 04:41:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lSyIe-0001VO-1S for emacs-devel@gnu.org; Sun, 04 Apr 2021 04:40:04 -0400 Original-Received: from familiekainz.at ([37.187.20.171]:39668 helo=ns3035380.ip-37-187-20.eu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lSyIa-00063k-6E for emacs-devel@gnu.org; Sun, 04 Apr 2021 04:40:03 -0400 Original-Received: by ns3035380.ip-37-187-20.eu (Postfix, from userid 110) id 48AFF56; Sun, 4 Apr 2021 08:39:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=blind.guru; s=mail; t=1617525594; bh=UhvUUb98oaL6IPEU5Tig6a/AS+SdYDrK7O/zrU+M/HM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=dsAMSEXnqiCfJEK8HIux+/lOybu0qwjKdg2LAOMos2uAhsysxrjtP4ugeEnn2H9fy /lsA6cxH1SS/C/uquCBWz4RslqnnGkjcYgIlhA6ZPgah5j/2atBA3CDsHrTCo5Y0v1 hFiAjV6zHT/fFqY4x9QtYP/O8Fgf6T5iZG0GRauQ= Original-Received: from x1.blind.guru (84-115-55-45.cable.dynamic.surfer.at [84.115.55.45]) by ns3035380.ip-37-187-20.eu (Postfix) with ESMTPSA id 0ECD73E; Sun, 4 Apr 2021 08:39:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=blind.guru; s=mail; t=1617525584; bh=UhvUUb98oaL6IPEU5Tig6a/AS+SdYDrK7O/zrU+M/HM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=XBxenvQBy12OlcVpfnFJOgw3AcNXDONxsAioDJYR4FRTqXk8kzbXebShhAB1zqnTR h3ZUKnoia7cZhdwb7j3qtjaBNthd4IqkBfg6NevWYsaR0sWB/Y+9INSLXeaUkHm/lw SY9AGdSBItLV3nwgRvt3UfvVUg9OdTlQV8JZ3Kq4= Original-Received: by x1.blind.guru (Postfix, from userid 1000) id 42119E80CD5; Sun, 4 Apr 2021 10:39:42 +0200 (CEST) In-Reply-To: (Stefan Monnier's message of "Sat, 03 Apr 2021 23:10:27 -0400") Received-SPF: pass client-ip=37.187.20.171; envelope-from=mlang@blind.guru; helo=ns3035380.ip-37-187-20.eu X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:267384 Archived-At: Stefan Monnier writes: >>> You might also consider using `cl-defstruct`, which >>> doesn't suffer from such problems and is lighter weight. >> I was actually trying that at first, but it turned out I need >> inheritance based dynamic dispatch. > > I don't understand: cl-defmethod does inheritance-based dynamic > dispatch for defstructs just as it does for defclasses. Maybe I was using sloppy terminology, but as far as I can see, `cl-defstruc= t' can not have a parent relationship, so what I call inheritance-based dispatch isn't really possible with cl-defstruct? (defclass foo () ()) (cl-defmethod val ((foo foo)) 0) (defclass bar (foo) ()) (cl-defmethod val ((bar bar)) 1) --=20 CYa, =E2=A1=8D=E2=A0=81=E2=A0=97=E2=A0=8A=E2=A0=95