From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?VHXhuqVuLUFuaCBOZ3V54buFbg==?= Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter api Date: Mon, 6 Sep 2021 07:03:09 +0700 Message-ID: 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 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="24385"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?UTF-8?Q?Cl=C3=A9ment_Pit=2DClaudel?= , Theodor Thornhill , emacs-devel , Stefan Monnier , Eli Zaretskii , Stephen Leake To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Sep 06 02:04:16 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 1mN27U-00068Q-D7 for ged-emacs-devel@m.gmane-mx.org; Mon, 06 Sep 2021 02:04:16 +0200 Original-Received: from localhost ([::1]:57416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mN27S-000681-40 for ged-emacs-devel@m.gmane-mx.org; Sun, 05 Sep 2021 20:04:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mN26k-0005Pb-02 for emacs-devel@gnu.org; Sun, 05 Sep 2021 20:03:30 -0400 Original-Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:35763) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mN26i-0005al-EL; Sun, 05 Sep 2021 20:03:29 -0400 Original-Received: by mail-pj1-x102c.google.com with SMTP id mw10-20020a17090b4d0a00b0017b59213831so3233759pjb.0; Sun, 05 Sep 2021 17:03:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ZwGJhfyo4YtMy7B8B4fd8uFxdpjbw1OuEwMCQZ2Tzag=; b=ccchs8Hr1J5z0rk75smZ3boUAjUzumZgrn7fssS53WTQQyIoG8ZYSKQ9Ij2Qt3KKKW K0zMtQyWzrmiM2fWTCa1fukGYVXT+22KLo91e0x7Hk8xflLVhqIV2S7StADGRTkYEl21 ZMnoPvIgci7HSzCUKJMbUhZhUqZ1snrs9bu7OQPsx3a6sh1GzV2zTTAq+F8y1C74Yu+Y vLiJTq4f347+5vrLQcRC6REFh48rknghgCJmhYwrGuXjXPOLXJJXrSbp+WDmsoNt5F+M +ymiEf0SzKTo9apzJsgLibMEKgDRbZxHu5iAIXhyQVE/kbU8R1OhTmzpkXoFe2Nc5fmr kstw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ZwGJhfyo4YtMy7B8B4fd8uFxdpjbw1OuEwMCQZ2Tzag=; b=YV2fAUDEo2t3W/MP29yGwI6X6Bb6XFdD3XUFEGOqb/2GqI3YYSzlZoi1kwVzXJTDp0 THkCXcSkbbe/LX89q9Ak/dV87aUaUNZ/0IwcskNJ70DpM+qsWHAH++0FaMh/seKsB5mI cLIccMpamsxJAoVLm+/9KCHi/cEJSGQQbY8mBkIWOCc3Deb2SeNLVDWMbND9HzTT1Hx8 5mqwXteapBKnqBZiaFPJp97PMG0alFU4VDT1atlMtXMxnFNM+32I44MZMuiURv8bbl4r qAYsuUqNUp4XIKEtKAwYyJP6tgAs9/zAsd8onbKIj/FCOz481SbO+pHRaDXisnguzibA Tlwg== X-Gm-Message-State: AOAM532TOlOkDs0nmpZxtrqOhTo6hGDX1euCaXUa6/qv0It4AWrLLq0H ZXwxjUe+OO245SuejOp2lQ8xTud9F5CyHwUiyEM= X-Google-Smtp-Source: ABdhPJytoeL/m/485A0gJcH4Vie0TY3Lpt9MkHHFQChmy1TPraI/mO3KDLD/U9UN6ZxLM/jf8fh5QpDsXviCuzAPBPw= X-Received: by 2002:a17:902:ed8b:b0:138:b1c7:f3ab with SMTP id e11-20020a170902ed8b00b00138b1c7f3abmr8432229plj.77.1630886606091; Sun, 05 Sep 2021 17:03:26 -0700 (PDT) In-Reply-To: <4E876354-10D1-46B3-8124-CAE916261F08@gmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=ubolonton@gmail.com; helo=mail-pj1-x102c.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 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:274041 Archived-At: 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 loadin= g one; On the other hand, dynamic modules don=E2=80=99t come with much comp= lications. Yes, you need additional emacs-modules.h and tree-sitter-.= c to build it, but that=E2=80=99s about it. 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 li= bs from other sources as well (like self-built). They are not going to be Emac= s dynamic modules. > I can package some additional information with the module; I could maybe = distribute them through ordinary package.el facility, etc etc. 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.) > If I load the shared library directly, I need to reinvent the wheels for = loading, error reporting, searching in load-path, and others. 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? > And I was hoping to distribute pre-built modules anyway, so if all went w= ell, ordinary users don=E2=80=99t need to compile the modules. WDYT? 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. I= t provides both pre-built binaries and functions for users to compile on thei= r own. And it does so without putting language definitions in dynamic modules= . > P.S. what do you mean by =E2=80=9Cload path pollution=E2=80=9D? 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 nam= es showing up when the user enumerates entries on the load path trying to go t= o the source of a Lisp library. That's annoying, but bearable. > P.P.S. My impression is that other applications distribute language defin= itions by themselves, and it is not common for distort to package language = definitions, is that correct? I don't understand this. Can you rephrase it? All in all, you are severely underestimating the amount of complexity and w= heels you will have to reinvent in other places compared to the amount of code yo= u don't have to write by requiring language definitions to be in dynamic modu= les. (It's less than 100, most of which is docstrings and comments.) -- Tu=E1=BA=A5n-Anh Nguy=E1=BB=85n Software Engineer