From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Would (Eval-when-compile (require 'treesit)) eliminate the need for (declare-function)s? Date: Tue, 18 Apr 2023 10:46:34 -0700 Message-ID: References: <6E9242F5-EC30-4BA5-A290-0AA6CCB7ECE7@gmail.com> <83fs8ya17i.fsf@gnu.org> <83bkjm9zmn.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.500.231\)) 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="11556"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier , larsi@gnus.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Apr 18 19:47:41 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 1popQa-0002tf-UY for ged-emacs-devel@m.gmane-mx.org; Tue, 18 Apr 2023 19:47:40 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1popPr-0007ql-5R; Tue, 18 Apr 2023 13:46:55 -0400 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 1popPm-0007q3-LL for emacs-devel@gnu.org; Tue, 18 Apr 2023 13:46:50 -0400 Original-Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1popPk-0000cG-W6; Tue, 18 Apr 2023 13:46:50 -0400 Original-Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-63b67a26069so2353193b3a.0; Tue, 18 Apr 2023 10:46:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681840007; x=1684432007; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=V7hClcRvwG+3fVuO2uBdiCqdbTNdPKW46piO69MLFhA=; b=IpiZJeXcy4w4vIw+2lTdeAzOa+U4DH6HyCNK5f/cUElt4N81oWV16SHhzN2g5Aqf0C InIeVemVmXrxMkKC2NrA7vhQxCJUstLSEzpRr1MO/lzRKVxog2YowhTsxq1QZe3eamBV iFH8eoyK1uCSA8FnDZVnHDv99J7r3pbZlijHh+d1WGKfPb/pB0/N+KYssyJ5eNDAN9pA hH4oiyfltw//+voeUsiC9Kf23ERs5ttKIPUYyhR3HN+iwL/AegFkiovEVp2IXS7tnQ/2 ZQ+zX2+0HkCsSPGLJKnz9w2VvxFRZXooqhcpMhl9HVpeeufH8OHnE0N0dCu8AcNLfKED VWVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681840007; x=1684432007; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=V7hClcRvwG+3fVuO2uBdiCqdbTNdPKW46piO69MLFhA=; b=QUgTw/gIxBz9qvoJ9Z/W3dJaPDFw+ISusbyjqQFdVKaMhPOet2ypnqyTB9EPrtGd4t FGGm2Pf9Ev6Vliu2TgV3y4R7ZAr4DiAXa7r3D+uR3kAp1xgfAluzmrEkDR4cJULCKEIJ NI7fJuk3y7p7ofGHoye6trYe3d0MfKwyz5XaBrLHlBIP2jSJGmSC13rUryy58iYE/y2r NB26lIyrWrt5u1mieyfnVGchUvP2lBwpdU3X75aiiTaS2a+juIa91X2WnTKp374ekcKw bh5G3defCsqnsuwQ5/TZ772FF62MsHiMST2LHyD1dzvQaEDSfbH83aLdnaqE5rwV5bLX S94Q== X-Gm-Message-State: AAQBX9cC1CR9pTz2080VolYLc9wnci28SId2gNK0dc+RpPoE8P2epgOB J2bc04nM+Wd80FLwLEjWDcAgaUQpHKXJ6A== X-Google-Smtp-Source: AKy350b7JrCL0nx9eKxAb2H0SdnMpKUNvBq6Dzue2cq4mfjOH1g27ccSao1yfHPOrrKzLjTX+NhIpA== X-Received: by 2002:a05:6a00:88f:b0:639:d66c:8fc7 with SMTP id q15-20020a056a00088f00b00639d66c8fc7mr703423pfj.12.1681840006400; Tue, 18 Apr 2023 10:46:46 -0700 (PDT) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id e21-20020aa78255000000b0063b675f01a5sm7962723pfn.11.2023.04.18.10.46.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Apr 2023 10:46:45 -0700 (PDT) In-Reply-To: <83bkjm9zmn.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.500.231) Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=casouri@gmail.com; helo=mail-pf1-x42d.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, T_SCC_BODY_TEXT_LINE=-0.01 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:305415 Archived-At: >=20 > 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. >>=20 >>> 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. >>=20 >> But it makes sense for packages that do >>=20 >> (require 'treesit) >>=20 >> to be able to use those functions implemented in `treesit.c` without >> bothering with `declare-function`. >=20 > That's what I'm not sure about. If emacs isn=E2=80=99t built with tree-sitter it doesn=E2=80=99t 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=E2=80=99t = built with tree-sitter. And it=E2=80=99s easy to miss adding = declare-function=E2=80=99s.=20 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=