emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Versioned Tree-sitter parser libraries


From: Yuan Fu
Subject: Re: Versioned Tree-sitter parser libraries
Date: Mon, 17 Apr 2023 11:41:49 -0700


> On Apr 17, 2023, at 10:03 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Sun, 16 Apr 2023 20:03:50 -0700
>> Cc: Peter Oliver <p.d.oliver@mavit.org.uk>,
>> emacs-devel@gnu.org
>> 
>>> If we were to load a versioned shared library, how would Emacs know
>>> which version to load?
>> 
>> Another thing is that tree-sitter grammars don’t really have versions (API 
>> or ABI versions), except for a tree-sitter version.
> 
> AFAIR, there is an ABI version, and we even expose it to Lisp, no?

There is a version, but it’s kind of a internal/protocol version between 
tree-sitter library and tree-sitter grammars, and I don’t think it’s a standard 
ABI version per se.

> 
>>>> The background to this question is that I’m thinking about packaging 
>>>> Tree-sitter parsers as RPMs for Fedora 
>>>> (https://pagure.io/tree-sitter-json/blob/rawhide/f/tree-sitter-json.spec). 
>>>>  Typical Fedora practice 
>>>> (https://docs.fedoraproject.org/en-US/packaging-guidelines/#_devel_packages)
>>>>  is to assume that the unversioned symlink isn’t required for regular use, 
>>>> and to place it in a …-devel subpackage that wouldn’t usually be installed.
>>> 
>>> That practice is fine for when a program is linked against the
>>> library, because the -lFOO linker switch is supposed to take care of
>>> that, and Emacs doesn't need to know which version is being used.  But
>>> here we load the shared libraries at run time, so we must know their
>>> names.  These names are explicitly mentioned in the Emacs sources.
>> 
>> 
>> Since Emacs requests/hopes the package manager or the system will provide 
>> the grammars, it seems a good idea to support the common way libraries tend 
>> to be named. Even maybe just a additional look up for only xxx.0.0, since 
>> grammars don’t have ABI versions, at least for now.
> 
> I don't think I understand what you suggest in practical terms.  What
> does it mean "additional look up for only xxx.0.0"? and why only
> xxx.0.0?

I was suggesting that we do recognize ABI versions, but since tree-sitter 
grammars don’t really have a ABI version, and the version extension in 
filenames are just there by convention (of Fedora), we can expect the version 
extension to be always 0.0, should there be one.

Yuan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]