From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: Subprojects in project.el Date: Fri, 2 Dec 2022 23:26:07 +0000 Message-ID: References: <87zgcq68zp.fsf@ericabrahamsen.net> <87wn7oa0aw.fsf@gmail.com> <7a5b76fd-fb15-8c1e-ea29-bf11f7e0d2ae@yandex.ru> <87bkoya815.fsf@gmail.com> <0024a67d-b8e5-b35c-1b22-82541a170eb3@yandex.ru> <871qptai4d.fsf_-_@gmail.com> <83o7swyipe.fsf@gnu.org> <83sfi7v6dj.fsf@gnu.org> <45549e6b-942f-ee99-9123-8176545a159e@yandex.ru> <83zgceu8ch.fsf@gnu.org> <7c34024e-c2b6-033f-ff37-a0fdfc9f0cdb@yandex.ru> <83v8n2tbur.fsf@gnu.org> <83cz91gaaw.fsf@gnu.org> <0094a6f2-796e-bc8d-bee0-13ecb069d7e6@yandex.ru> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000008115be05eee0a564" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29381"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 03 00:25:50 2022 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 1p1FPi-0007QC-JV for ged-emacs-devel@m.gmane-mx.org; Sat, 03 Dec 2022 00:25:50 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p1FOz-0000ec-0y; Fri, 02 Dec 2022 18:25:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p1FOx-0000eP-Lq for emacs-devel@gnu.org; Fri, 02 Dec 2022 18:25:03 -0500 Original-Received: from mail-oa1-x2f.google.com ([2001:4860:4864:20::2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p1FOw-0006Vj-5t for emacs-devel@gnu.org; Fri, 02 Dec 2022 18:25:03 -0500 Original-Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-12c8312131fso7228078fac.4 for ; Fri, 02 Dec 2022 15:25:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=YDxLTdIzrOx5FsLwJo6ZLO5dGYsu68Ak3VtDDGSRCRk=; b=OEhY/rFwvBP/g+FvBXQQ6TnzlxFHyoJIxZQHg9Gay+BdsGKUs/llbcfNz12ELWgfks 4fhi0cFhBzdKbvMQrd+/a77jsCc21sZWKVJBFbJ7ga0dclRqgTNsyjdQUjx3I8IVs6jE 8MBosecZwmnSO44yTA80aZhfmT4c85nYBtCVCPF771apuSQIKgjeSTpXZOrsVjynB3OH MpfVDfplRTBSj1jDXT+MoJf/2NxbRwPFnUfpyC3mZ9b4KcdPd+i4gsQuZOAZChUAIPxD 7ZEpoPilr2xFVJ4CSSvwGEb5oxUd/0o3qgvf40WVPGaiLbgxCZidI29RwMTdi3fZOo/m 4gNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YDxLTdIzrOx5FsLwJo6ZLO5dGYsu68Ak3VtDDGSRCRk=; b=U+iDIUvvZPbXpX3asGuBwFw7eUp4oAg1SgiB1Wy5tBVtINiZFJejYpIz860dnr1fb6 fWMcQ/SFwAluOfP/1qayc0GD9p9zjNzlcaRVL5nWm8xACS0ZQ9f9GTh/g5qmshxoQyMc MLn19uLIMQ9nuNptHaNmN2OiVKZXmupnTXCeEwjXUH2I52RB67QnFzw3AzCRKXDDaUJn lQG5RP46plhdYTz7VOewR/8zZNGQy9CVLMRplLDHKx/qMBqG0OrOM9wQQsTVF85vwTJt 8UZebEkKljjl4IJ52Tl+tShbzxmMIKl89ekbQFXBbdSCju0/wFeiSmwxcirKXXB3/Gh9 dGLg== X-Gm-Message-State: ANoB5pkz+ttxHsb41BFz5EEt2B1CvsngH9gUvg6138q4woEuTf3jyclN PtbRNK0iZ43uhe2kBWQKlaIRRewZFwNE7am3phU= X-Google-Smtp-Source: AA0mqf5gRI7RTwU+ySUG+pgFdOwp8QBiLS1DzT+x0Fe67sIQ4LFKw+8YHrht2BQfYusQEdhP5jYvVlhU6jbn4eVzE/U= X-Received: by 2002:a05:6871:410e:b0:143:7889:c525 with SMTP id la14-20020a056871410e00b001437889c525mr19987881oab.171.1670023500337; Fri, 02 Dec 2022 15:25:00 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2001:4860:4864:20::2f; envelope-from=joaotavora@gmail.com; helo=mail-oa1-x2f.google.com 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, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, 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: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:300847 Archived-At: --0000000000008115be05eee0a564 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Dec 2, 2022 at 3:44 PM Stefan Monnier wrote: > Indeed. AFAIK the general approach for APIs that rely on CLOS-style OO > programming is that all the classes are kept "abstract" and what you see > is only generic functions. IOW the API is exclusively defined by the > generic functions. > Yes, and such an API is called a "protocol" in CLOS parlance. But the exclusivity you suggest isn't true: classes and inheritance are a big part of CLOS and CLOS-style OO. IME, CLOS's power is only fully realized when you use both. In Emacs Lisp's flavour of CLOS, generic functions have somewhat esoteric dispatching mechanisms that I've never seen or needed in a CLOS system when using classes, inheritance, and method combinations. So +1 for using classes in more Elisp packages. See for example how eglot.el subclasses jsonrpc.el's classes. It's not as easy as in Common Lisp since we don't have things like the beautiful inspector of SLY/SLIME. But classes still beat those funky cons by a mile IMHO. Jo=C3=A3o --0000000000008115be05eee0a564 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Dec 2, 2022 at 3:44 PM Stefan Mon= nier <monnier@iro.umontreal.= ca> wrote:
Indeed.=C2=A0 AFAIK the genera= l approach for APIs that rely on CLOS-style OO
programming is that all the classes are kept "abstract" and what = you see
is only generic functions.=C2=A0 IOW the API is exclusively defined by the<= br> generic functions.

Yes, and such an API= is called a "protocol" in CLOS parlance.=C2=A0 But the
exclusivity you suggest isn't true: classes and inheritance are a= big
part of CLOS and CLOS-style OO.=C2=A0 IME,=C2=A0 CLOS&#= 39;s power is only fully
realized when you use both.

In Emacs Lisp's flavour of CLOS,=C2=A0 generic fu= nctions have somewhat
esoteric=C2=A0 dispatching mechanisms = that I've never seen or needed in a
CLOS system when usi= ng classes, inheritance, and method combinations.

So +1 for using classes in more Elisp packages.=C2=A0 See for = example how
eglot.el subclasses js= onrpc.el's classes. It's not as easy as in Common
Lisp since we don't have things like the beautiful= inspector of SLY/SLIME.
But classes st= ill beat those funky cons by a mile IMHO.

Jo=C3=A3o
--0000000000008115be05eee0a564--