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: Tree-sitter api Date: Sun, 5 Sep 2021 17:23:33 -0700 Message-ID: <0A3F5464-B90D-4D47-BBDD-CCA26D877F43@gmail.com> References: <83r1f7hydn.fsf@gnu.org> <95F37923-5BF9-4D81-B361-267CF119FBCA@gmail.com> <735AF34C-FD18-4A6A-A99D-E5D8EB4DE4F3@gmail.com> <40611F1F-7B5C-4885-A2CA-CE709ED8D22B@gmail.com> <4E876354-10D1-46B3-8124-CAE916261F08@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) 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="35969"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?utf-8?Q?Cl=C3=A9ment_Pit-Claudel?= , Theodor Thornhill , emacs-devel , Stefan Monnier , Eli Zaretskii , Stephen Leake To: =?utf-8?B?VHXhuqVuLUFuaCBOZ3V54buFbg==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Sep 06 02:24:55 2021 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 1mN2RS-00098N-EK for ged-emacs-devel@m.gmane-mx.org; Mon, 06 Sep 2021 02:24:54 +0200 Original-Received: from localhost ([::1]:60198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mN2RR-0000Xs-2B for ged-emacs-devel@m.gmane-mx.org; Sun, 05 Sep 2021 20:24:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38594) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mN2QO-00089R-Rn for emacs-devel@gnu.org; Sun, 05 Sep 2021 20:23:48 -0400 Original-Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330]:36480) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mN2QC-00024H-Ps; Sun, 05 Sep 2021 20:23:46 -0400 Original-Received: by mail-ot1-x330.google.com with SMTP id a20-20020a0568300b9400b0051b8ca82dfcso6763831otv.3; Sun, 05 Sep 2021 17:23:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=JMIL8pC6QY9n2bsu1VI1jx1U2QVYkxAiHN9RGoTeCkg=; b=gJJtBTM1pvIbOyhaevThpvII8xP9jBZQzSOKH3q46dRwdjpSVZBMk3B6LtxmdQreH8 p0ZcawI0LCe2AJwCrjp+Q2FgfYgDSMxkTpNbxI2kDP1ibka7IUAeRcDW78Aspajr+ftk ViDZ5yrb5eyh1JEGOH77UuWeapRFhLv8joRj1U18IhTKFi3nbqeiAw/RkIkt7IETsEk2 8c/bxe5lX8nIEOWkhK+QACaSEpY/ojp1dqrSsIFfCfFzgzA/uolCsZ3W79fe4G+CebD0 ZNdLO4uw34VBkReikU5pYeKKnnfxkgkYb4Tc/l+Z6670W/CqNbtANZgh8cYm3q4/c4/7 JYIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=JMIL8pC6QY9n2bsu1VI1jx1U2QVYkxAiHN9RGoTeCkg=; b=YFQ0qtZmpvb0XdOLgHguWxuDrXVVOCPidxpBrX4VHM6M2A6kjP+2rIkojQLxgj+0yn Tr8c5ACdODHkiygKQin2agKs/P8MMIO5ytEU4lmFoqnRPPesPSm5TmNlbxFiXskunS5B yuhB5exSNoVItXaGbwU+i3UfwwpgGc8sMENLg2W6ZD0hCfOOeRKlwJsPu6WEFIIW2V3X Bm9dYh2fMGejHUolyQmGZAehrNIuVzGb6NDZZM0k/GcSnyCfQMcc+MFllrojUqJt6bAi EGlOqmW76yVcHTZc8Whacl7hoO/OjcMNth30fEk+zrGX2vx4WFqop74AVrTwo9+3hlp9 GBrA== X-Gm-Message-State: AOAM533Or8w+tImDQQ0YSMVUKXDv8Eehqb95p+bxCYcKAIzzXy7zA2rm SkWWOtrs5IyGDfDU6nHmGXs= X-Google-Smtp-Source: ABdhPJx2mcDU2WYmAOn/yNts/PUkG7CNGr5ZTbKgvoplWpMLs7XJaQBfqeOIwXg0nAJNwPgTT7NsMQ== X-Received: by 2002:a05:6830:4410:: with SMTP id q16mr8871945otv.216.1630887815151; Sun, 05 Sep 2021 17:23:35 -0700 (PDT) Original-Received: from smtpclient.apple ([2600:1700:2ec7:8c9f:8d83:1bf4:cfca:c0e8]) by smtp.gmail.com with ESMTPSA id n13sm1459178otr.11.2021.09.05.17.23.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Sep 2021 17:23:34 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3654.120.0.1.13) Received-SPF: pass client-ip=2607:f8b0:4864:20::330; envelope-from=casouri@gmail.com; helo=mail-ot1-x330.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) 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.23 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" Xref: news.gmane.io gmane.emacs.devel:274042 Archived-At: > On Sep 5, 2021, at 5:03 PM, Tu=E1=BA=A5n-Anh Nguy=E1=BB=85n = wrote: >=20 > On Mon, Sep 6, 2021 at 3:19 AM Yuan Fu wrote: >> Dynamic modules comes with nice things, for example Emacs looks for = them automatically in load-path; Emacs reports errors with it has = problem loading one; On the other hand, dynamic modules don=E2=80=99t = come with much complications. Yes, you need additional emacs-modules.h = and tree-sitter-.c to build it, but that=E2=80=99s about it. >=20 > See my other discussion with Eli. We want to rely on the distro to = provide the > binaries and the `tree-sitter` CLI program, and to be able to use = shared libs > from other sources as well (like self-built). They are not going to be = Emacs > dynamic modules. >=20 >> I can package some additional information with the module; I could = maybe distribute them through ordinary package.el facility, etc etc. >=20 > Neither of these requires it to be a module at all. (Also note that = package.el > isn't able to handle platform-specific files at the moment.) >=20 >> If I load the shared library directly, I need to reinvent the wheels = for loading, error reporting, searching in load-path, and others. >=20 > The non-module-specific part of loading is provided by `dynlib.h`. = There's no > wheel to reinvent here. What error reporting do you mean? (You are = going to need > additional checks for ABI compatibility anyway.) Searching a load path = (not the > `load-path`) is not that complicated. What are the others? >=20 >> And I was hoping to distribute pre-built modules anyway, so if all = went well, ordinary users don=E2=80=99t need to compile the modules. = WDYT? >=20 > It's good to provide that convenience, but it should not be at the = expense of > not being able to use binaries from other sources, or to build the = binaries on > their own. The `tree-sitter-langs` package already enables both of = these. It > provides both pre-built binaries and functions for users to compile on = their > own. And it does so without putting language definitions in dynamic = modules. >=20 >> P.S. what do you mean by =E2=80=9Cload path pollution=E2=80=9D? >=20 > I meant to say load path collision, but since you use = `tree-sitter-{lang}` for > the module name, that's less of a problem. Load path pollution is = these names > showing up when the user enumerates entries on the load path trying to = go to the > source of a Lisp library. That's annoying, but bearable. >=20 >> P.P.S. My impression is that other applications distribute language = definitions by themselves, and it is not common for distort to package = language definitions, is that correct? >=20 > I don't understand this. Can you rephrase it? >=20 > All in all, you are severely underestimating the amount of complexity = and wheels > you will have to reinvent in other places compared to the amount of = code you > don't have to write by requiring language definitions to be in dynamic = modules. > (It's less than 100, most of which is docstrings and comments.) I see your point. If no one else object, I=E2=80=99ll change the code to = use shared libraries instead of dynamic modules. Thanks for the input = :-) Yuan