From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter documentation Date: Tue, 08 Nov 2022 16:40:25 +0200 Message-ID: <83h6z9y0fa.fsf@gnu.org> References: <48A65188-BBC6-442F-A552-5FEA1416F936@gmail.com> <83a653ynec.fsf@gnu.org> <14DDD315-2399-41F7-B1C6-10433C27CF5C@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="428"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Nov 08 15:41:57 2022 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 1osPnZ-000AT0-II for ged-emacs-devel@m.gmane-mx.org; Tue, 08 Nov 2022 15:41:57 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1osPmW-0000Bz-FV; Tue, 08 Nov 2022 09:40:56 -0500 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 1osPmQ-0000AK-Bq for emacs-devel@gnu.org; Tue, 08 Nov 2022 09:40:46 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1osPmN-0001Ef-Sw; Tue, 08 Nov 2022 09:40:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=rGSWrWqzdPmyJSkgZu128w8oTLI8ykDzI73IintL2rE=; b=KeybvLNFP6gT yRJk2/AMVMQMqGrHSYn40O/bYayojqIqrIRhtPnz+TduIBRo45b2JUvlQh3xvtKzohPO1fEQOg5q2 No1ZiMGf6sUEt+ekFLut3Q72UiD0ybCIAWvwjP3nYDv4NAxFpsw9z2cAGIv1axmhJCynezUWKLYdU fOYXoVzfvxFSuPRNDtg+iE83zAYNTtre5HPm4mDZjL++KGjlfeFj/0ZJqV8GjBPPE0bmjrjCPbd+c t60z7vIolN0+iyHDDt7BZaAhEuK/8ogAtTtBuPD4uFeVZhh+yIP1IFQ33+vi2MwiPwWhOTCZm+bPn R9gOQqO46jsr4iJnwXZ+pA==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1osPmH-0003nU-If; Tue, 08 Nov 2022 09:40:39 -0500 In-Reply-To: <14DDD315-2399-41F7-B1C6-10433C27CF5C@gmail.com> (message from Yuan Fu on Mon, 7 Nov 2022 12:47:30 -0800) 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:299346 Archived-At: > From: Yuan Fu > Date: Mon, 7 Nov 2022 12:47:30 -0800 > Cc: emacs-devel@gnu.org > > > In that case, "triplets" is definitely incorrect, but I had no way of > > understanding that this is possible. > > > > It should be possible top describe this kind of argument list, but > > does it really have to be so complicated? These are not internal > > functions, so Lisp programmers will have to battle with this signature > > all the time. Can we make the function's signature easier to > > document, understand, and use? > > > > For example, what about accepting an alist as the argument, where each > > alist element specifies a query and its keyword/value pairs that > > customize the query? > > Alists has too much layers of parenthesizes that is verbose and easy to get wrong. Compare: I don't share your pessimism about alists. And the way the functions are defined now are also very error-prone and complicate the code, which needs to distinguish between several very different signatures. How about making the query itself the value of a keyword/value pair? Like this: :language 'python :override t :feature 'string :query '((string :anchor "\"" @python--treesit-fontify-string) (string) @contextual)