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: Tree sitter: Should *-ts-modes derive from a common base? Date: Sat, 25 Mar 2023 09:16:22 +0000 Message-ID: References: <6b7d4ada-573f-7847-752a-097f6ac53b8a@yandex.ru> 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="6913"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Phil Sainty , emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Mar 25 12:54:14 2023 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 1pg2TN-0001Tu-Q5 for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Mar 2023 12:54:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pg2Se-0006gB-Om; Sat, 25 Mar 2023 07:53:28 -0400 Original-Received: from [2001:470:142:3::10] (helo=eggs.gnu.org) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pg2Sd-0006ce-CK for emacs-devel@gnu.org; Sat, 25 Mar 2023 07:53:27 -0400 Original-Received: from mail-yw1-x1133.google.com ([2607:f8b0:4864:20::1133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pg2Sb-0007tb-Ap for emacs-devel@gnu.org; Sat, 25 Mar 2023 07:53:26 -0400 Original-Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-536af432ee5so83090477b3.0 for ; Sat, 25 Mar 2023 04:53:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679745204; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=/IZ85a2HFevflflhnmKRSHBIxCljahiW8n675QCS/08=; b=HolOYHwUiL0k/JX0uctntfiDVI0wPL+x5NQU03qxKzjdExcLbBZw87UkmbkToZ8E4T 5OrEdhOgB0oMyOdq96GleH5j058Oeg3E2PqOH3nWQR+OsHSYHR5FIJgDfq8/XPPcYXX+ WGaGmeNeomVxH+lo/iVGW35SY3ErVGMNScPEK5ddWWWRqt+eiduPdBYZxKvGuzyEYwzb 2p2CzpbN67t8pcN49/I2pHJAADfmvUHDcsRSf9rQl8SbzO4g8YpafpydywUz+qre/5Yl 62ZWjIbymxVheLWmHJMIOi7RZIUdy3bRwSGraZDw4ca+raPd4yrnnEMGhGj9aXsJAIBc ExCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679745204; h=content-transfer-encoding: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=/IZ85a2HFevflflhnmKRSHBIxCljahiW8n675QCS/08=; b=yIlIGVeOioDVQQr2ySwbH9AKb8yuAIUd61s2zGga8NFfQqgn33MEpfPabEMHib8Bx0 cuqWh0Ch/XS2i7eGpZKQ+RxG9WiPNR2I2Brm12b2nRYYqafbFEVo87nHyBiOhFU+e8YQ hxqxhGyklrwdzx4elOvEIZDX7cxxwBiWAknsabaKe6x4ZIeE40DDp1VSe5h7VkXTCSwv gYPVehJJXIbCJcXIV0gWmBDKDhq4fXOc8gv/NdRMZAcWoFoWT0yeAagtWqR8tZdq7Xf+ suAxM7MAUNqudMY83L24VeQjqkFUcsRmSlzo08DSdnKlk4jsNLQqNrPEYDNLB3cf661o 2dOA== X-Gm-Message-State: AAQBX9fl/myWexhC8VAr0McMKcW6jULig0YRYIEeKuad9WyIg7m+ZUTu /i1ULwghZDGiarX08xejjteBhnzjDCSVmmVtV1Z4R+FA X-Google-Smtp-Source: AK7set+qcsNBY5iMUl5NcZO5Thrjmf2Y7j35C22moQwCDK6NxEspPX1U99nTmGPP1C4xFo0sPnO0aOk8C/ARqTWE8j0= X-Received: by 2002:a05:6808:1b20:b0:384:1cf9:912e with SMTP id bx32-20020a0568081b2000b003841cf9912emr1613489oib.5.1679735671822; Sat, 25 Mar 2023 02:14:31 -0700 (PDT) In-Reply-To: <6b7d4ada-573f-7847-752a-097f6ac53b8a@yandex.ru> Received-SPF: pass client-ip=2607:f8b0:4864:20::1133; envelope-from=joaotavora@gmail.com; helo=mail-yw1-x1133.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, 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:304760 Archived-At: On Wed, Mar 22, 2023 at 7:32=E2=80=AFAM Dmitry Gutov wro= te: > > On 21/03/2023 11:30, Phil Sainty wrote: > > The case I've spotted thus far which wouldn't work is the CSS modes, > > where we have this: > > > > (define-derived-mode css-base-mode prog-mode "CSS" > > (define-derived-mode css-mode css-base-mode "CSS" > > (define-derived-mode css-ts-mode css-base-mode "CSS" > > > > That could be refactored if this idea was a sensible one. > > How would you refactor it? We don't have multiple inheritance. There are many mechanisms of code reuse besides inheritance. In lisp-based modes there is the the lisp-mode-variables, for example. So IMO it's fine to use a combination of single inheritance and such a mechanism. Phil's idea is very pertinent and should be addressed sooner not later, because the potential for messy duplicated code or just misinheritance is high later down the road. The lisp-mode fiasco comes to mind. Jo=C3=A3o