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 13:19:09 -0700 Message-ID: <4E876354-10D1-46B3-8124-CAE916261F08@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> 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="30748"; 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 Sun Sep 05 22:20:18 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 1mMycj-0007m7-AG for ged-emacs-devel@m.gmane-mx.org; Sun, 05 Sep 2021 22:20:17 +0200 Original-Received: from localhost ([::1]:36236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMycf-0002a5-Ka for ged-emacs-devel@m.gmane-mx.org; Sun, 05 Sep 2021 16:20:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40348) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMybj-0001ss-0o for emacs-devel@gnu.org; Sun, 05 Sep 2021 16:19:15 -0400 Original-Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]:35564) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mMybh-0001Rj-FW; Sun, 05 Sep 2021 16:19:14 -0400 Original-Received: by mail-oi1-x236.google.com with SMTP id r26so6343025oij.2; Sun, 05 Sep 2021 13:19:12 -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=l/3nE27kF3h/GSuSYk1CuHKTW5Ezl/Q72/6bog3Mvsk=; b=FQ76N0cVJi60gOj6r9965f0w9OXpQ9pvkBylNSUuxpAaDM3V6I3ptkhlBB6rH6/RAz 7Z/cYwdZrowlA6Yw685ZxL6+A++YUJbNhPzawQCsSQApxChhIIcm4ME2aRKeKOzNhlEP YX0GqGk9zQp/vaK8JWDyRAbmTXHCQvwPrKr5WDFJO9Mj/JNUhdhUKCZBGgwNUXWwbn7J NyDf4/YmMzgxcvxOIcy/+rvni/5ccC3+xBRdwgwnSNTaX9zuy5XtlZo9+ydZ6jFPVrwI A5vbxmitKq+4KO2KXmvNGgMjaw5mU8hA13kg4CvVvbt8vlqacUlto0DKTBrDTfXcZAvv xxOg== 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=l/3nE27kF3h/GSuSYk1CuHKTW5Ezl/Q72/6bog3Mvsk=; b=Mij7Y/ijg1KMyFHQZCRA4bnc/cM1qKSMrdP4uMpaKWJfn0o4VmWVeJo4V0SlRn+HN0 GZe42yYJ1yqbnSlYCPNJQJbV7LD/GURKIYyfkz6gckWMtiibRX91lHTCyTI4QkOaoBvk yP0CPz04Ln8QHqyemB5LxxunzgZ48Jx27lKW4Eyu/GfRixRk3R6juZ6aTWkd3N1lynRo Pmx/OUiyRPlYQ6iHNAlrjhwFPmfaqFhapcPP0vWoX8QPm8eX/dUlNL5Hdj4Z6nWq3w0T BsnamB1D8ZgLC7SYImC64rzQUFmAo15FmbEqHEXLvr7ckQ5ibqRmB1oWqo6TWUSJfdNb pu0w== X-Gm-Message-State: AOAM533D/s9m0eKr5eNlrXZ9U32zm9vt289tsV1IJFlliCDo2rNds2Kl zbAhFxrhnQ8r9fksJNyrbgI= X-Google-Smtp-Source: ABdhPJyHSTlJRkFABmoLkvAopL6hHv6GbDyCFCdrie3v84q+4WWqkEgI6A9B2L3XocnaWJgFana9xg== X-Received: by 2002:aca:d610:: with SMTP id n16mr6628536oig.170.1630873151592; Sun, 05 Sep 2021 13:19:11 -0700 (PDT) Original-Received: from smtpclient.apple ([2600:1700:2ec7:8c9f:8d83:1bf4:cfca:c0e8]) by smtp.gmail.com with ESMTPSA id k8sm1257299oom.20.2021.09.05.13.19.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Sep 2021 13:19:11 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3654.120.0.1.13) Received-SPF: pass client-ip=2607:f8b0:4864:20::236; envelope-from=casouri@gmail.com; helo=mail-oi1-x236.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:274036 Archived-At: > On Sep 5, 2021, at 9:45 AM, Tu=E1=BA=A5n-Anh Nguy=E1=BB=85n = wrote: >=20 > On Sat, Sep 4, 2021 at 10:31 PM Yuan Fu wrote: >> I packaged language definitions into dynamic modules: the system is = there, why not take advantage of it? Do you think this approach can be = improved in some way? >=20 > The language definitions just need to come from dynamically-loadable = shared > libraries. They don't have to be Emacs dynamic modules, which bring = additional > unnecessary complications, e.g. build difficulty, load path pollution, = or > inability to load grammar binaries from other sources like distro's = package > repos. It's better to just load the shared libs directly without going = through > module machinery. Use the functions in `dynlib.h`. >=20 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; I can package some additional information with the module; = I could maybe distribute them through ordinary package.el facility, etc = etc. If I load the shared library directly, I need to reinvent the = wheels for loading, error reporting, searching in load-path, and others. = 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. 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? P.S. what do you mean by =E2=80=9Cload path pollution=E2=80=9D? 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? Yuan=