From: Yuan Fu <casouri@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
larsi@gnus.org, emacs-devel@gnu.org
Subject: Re: Would (Eval-when-compile (require 'treesit)) eliminate the need for (declare-function)s?
Date: Tue, 18 Apr 2023 10:46:34 -0700 [thread overview]
Message-ID: <F1485BF6-3E48-4184-913A-6BB390AE59B1@gmail.com> (raw)
In-Reply-To: <83bkjm9zmn.fsf@gnu.org>
>
> IIUC one way to look at this is that `treesit.el` wants to "re-export"
> the functions provided by `treesit.c` so users of `treesit.el` don't
> need to know whether the function they call is implemented in C or
> in ELisp?
Not quite IMO, see below.
>>
>>> Even if it does work reliably, I'm not sure we want that. It is
>>> better to have declare-function where the function is used, as that
>>> makes maintenance easier and less error-prone.
>>
>> But it makes sense for packages that do
>>
>> (require 'treesit)
>>
>> to be able to use those functions implemented in `treesit.c` without
>> bothering with `declare-function`.
>
> That's what I'm not sure about.
If emacs isn’t built with tree-sitter it doesn’t make much sense to use functions in treesit.c anyway. The real problem is that some files need to be byte-compiled even when emacs isn’t built with tree-sitter. And it’s easy to miss adding declare-function’s.
Is there any other way to help the situation that we can do in Lisp? Ie, without making all functions always defined in treesit.c? Because I played it in my head a bit, and it looks really messy.
Yuan
prev parent reply other threads:[~2023-04-18 17:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-17 3:12 Would (Eval-when-compile (require 'treesit)) eliminate the need for (declare-function)s? Yuan Fu
2023-04-17 3:31 ` Ruijie Yu via Emacs development discussions.
2023-04-17 13:29 ` Philip Kaludercic
2023-04-17 17:05 ` Eli Zaretskii
2023-04-17 17:25 ` Stefan Monnier
2023-04-17 17:39 ` Eli Zaretskii
2023-04-18 17:46 ` Yuan Fu [this message]
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=F1485BF6-3E48-4184-913A-6BB390AE59B1@gmail.com \
--to=casouri@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=larsi@gnus.org \
--cc=monnier@iro.umontreal.ca \
/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).