From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: casouri@gmail.com, theo@thornhill.no, emacs-devel@gnu.org
Subject: Re: master 09b5f00613: ; Fix calls to treesit functions
Date: Tue, 20 Dec 2022 17:44:14 +0200 [thread overview]
Message-ID: <83wn6maxm9.fsf@gnu.org> (raw)
In-Reply-To: <jwv7cymrt7v.fsf-monnier+emacs@gnu.org> (message from Stefan Monnier on Tue, 20 Dec 2022 10:35:16 -0500)
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: casouri@gmail.com, theo@thornhill.no, emacs-devel@gnu.org
> Date: Tue, 20 Dec 2022 10:35:16 -0500
>
> >> I think this can be done simply by listing which functions are always
> >> defined.
> >
> > No, this is not enough, IMO. What is needed in addition is to
> > document how to know, with each of these always-defined functions,
> > whether tree-sitter can be used (most probably, by examining the
> > returned value).
>
> That should be an obvious consequence of the behavior of the function
> without needing to document it specifically.
>
> Like with `treesit-parser-list`: if the list is empty, then it means we
> don't have any parser at hand and that's it.
With functions returning a list, this is almost obvious, yes. But
what about functions that return a buffer position, or a symbol, or
some other data type? In those cases it is much less trivially
evident what to expect when tree-sitter support is unavailable. Thus
the need to document this stuff.
> >> Then we just have to make sure that those functions can be
> >> implemented correctly even without Tree-sitter.
> > The implementation without tree-sitter will probably be trivial, like
> > return nil or something like that.
>
> Yes, but for some functions this is not an option because we can't
> provide a correct behavior without using Tree-sitter. So we have to
> choose the set of always-defined functions based on whether they *can*
> be correctly implemented without Tree-sitter.
Agreed. My point was different, see abovge.
> `treesit-available-p`, `treesit-parser-list`, and `treesit-node-at` are
> functions we can implement without Tree-sitter, because nil is already
> the correct answer for those, without having to add any special
> case in their docstring for that.
If those are all that is needed, yes.
next prev parent reply other threads:[~2022-12-20 15:44 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <167138365421.15060.2886694741391315956@vcs2.savannah.gnu.org>
[not found] ` <20221218171414.77B8EC0060F@vcs2.savannah.gnu.org>
2022-12-18 20:19 ` master 09b5f00613: ; Fix calls to treesit functions Stefan Monnier
2022-12-18 23:02 ` Yuan Fu
2022-12-18 23:54 ` Stefan Monnier
2022-12-19 8:26 ` Yuan Fu
2022-12-19 3:23 ` Eli Zaretskii
2022-12-19 3:37 ` Stefan Monnier
2022-12-19 6:26 ` Theodor Thornhill
2022-12-19 8:35 ` Yuan Fu
2022-12-19 9:07 ` Theodor Thornhill
2022-12-19 12:29 ` Eli Zaretskii
2022-12-19 13:47 ` Theodor Thornhill
2022-12-19 14:40 ` Eli Zaretskii
2022-12-19 14:51 ` Theodor Thornhill
2022-12-19 15:21 ` Eli Zaretskii
2022-12-19 15:44 ` Dmitry Gutov
2022-12-19 16:42 ` Theodor Thornhill
2022-12-19 16:57 ` Eli Zaretskii
2022-12-19 16:13 ` Stefan Monnier
2022-12-19 16:42 ` Theodor Thornhill
2022-12-20 0:12 ` Yuan Fu
2022-12-20 3:39 ` Eli Zaretskii
2022-12-20 4:37 ` Stefan Monnier
2022-12-20 13:59 ` Eli Zaretskii
2022-12-20 15:35 ` Stefan Monnier
2022-12-20 15:44 ` Eli Zaretskii [this message]
2022-12-20 16:02 ` Stefan Monnier
2022-12-21 0:36 ` Yuan Fu
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=83wn6maxm9.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=casouri@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=theo@thornhill.no \
/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).