From: "João Távora" <joaotavora@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: Phil Sainty <psainty@orcon.net.nz>, emacs-devel@gnu.org
Subject: Re: Tree sitter: Should *-ts-modes derive from a common base?
Date: Sat, 25 Mar 2023 09:16:22 +0000 [thread overview]
Message-ID: <CALDnm5336vCQGiyHKa_tvW=McUY6ZRC6S_9PX3ieuYjwr915nA@mail.gmail.com> (raw)
In-Reply-To: <6b7d4ada-573f-7847-752a-097f6ac53b8a@yandex.ru>
On Wed, Mar 22, 2023 at 7:32 AM Dmitry Gutov <dgutov@yandex.ru> wrote:
>
> 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ão
next prev parent reply other threads:[~2023-03-25 9:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-21 9:30 Tree sitter: Should *-ts-modes derive from a common base? Phil Sainty
2023-03-22 7:32 ` Dmitry Gutov
2023-03-25 9:16 ` João Távora [this message]
2023-03-22 10:07 ` Daniel Martín
2023-03-23 8:50 ` Phil Sainty
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CALDnm5336vCQGiyHKa_tvW=McUY6ZRC6S_9PX3ieuYjwr915nA@mail.gmail.com' \
--to=joaotavora@gmail.com \
--cc=dgutov@yandex.ru \
--cc=emacs-devel@gnu.org \
--cc=psainty@orcon.net.nz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).