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: Code quality of some -ts-mode major modes Date: Fri, 17 Mar 2023 17:31:05 +0200 Message-ID: <835yaze6o6.fsf@gnu.org> References: <87fsa3g05n.fsf@posteo.net> <87bkkrft9n.fsf@posteo.net> <83a60beb5a.fsf@gnu.org> <87v8izjtf2.fsf@posteo.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5912"; mail-complaints-to="usenet@ciao.gmane.io" Cc: ruijie@netyu.xyz, casouri@gmail.com, emacs-devel@gnu.org To: Philip Kaludercic Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Mar 17 16:32:03 2023 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 1pdC3l-00019B-Hw for ged-emacs-devel@m.gmane-mx.org; Fri, 17 Mar 2023 16:32:01 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pdC2x-0005Po-60; Fri, 17 Mar 2023 11:31:11 -0400 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 1pdC2v-0005PQ-Ri for emacs-devel@gnu.org; Fri, 17 Mar 2023 11:31:10 -0400 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 1pdC2u-0000q1-UM; Fri, 17 Mar 2023 11:31:08 -0400 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=6tbHOUkDew806AOWrnbHaVnf2iO/VvXPEJaVhRqLq00=; b=NuBkCqO6tbJH 0mCI7OKF/mK+vy1Xo+NGp0gGuIegRrIQ76Fy/eIY+i7EjqC1YlsAUCQFoFPpBixFcqhuJVq/Boc21 RZuivu3w5e3JbMK7XnSiFTa+KQvWBVojN5o0y4QWQgBbJWbShxnRBWqp2IyL1AVnfxjoZXNXrdtsP HcVzetkOqbR0eVT9ttpwh5HrM6TWwanrlMcwQ3c+fpK8cUDxcbkOl+rdufVGxYrfoOpiwdQlZi/00 8ptoOSHGexNhO/2gVe2ARDieqgmteEkHqj9ilmGRlAPR8fkTQoJBG1mFLGNTi4yGcGMpFt0kl7vcj RbqlpIywJwNyQpPY3kZj2A==; 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 1pdC2r-0008Bm-FR; Fri, 17 Mar 2023 11:31:06 -0400 In-Reply-To: <87v8izjtf2.fsf@posteo.net> (message from Philip Kaludercic on Fri, 17 Mar 2023 15:20:49 +0000) 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:304553 Archived-At: > From: Philip Kaludercic > Cc: ruijie@netyu.xyz, casouri@gmail.com, emacs-devel@gnu.org > Date: Fri, 17 Mar 2023 15:20:49 +0000 > > >> The rule-of-thumb that I go by is that `if' is used if you have two > >> cases you are interested in, especially if you are interested in the > >> return value, while `when' is more "imperative" in style and indicates > >> to the reader that the code is being executed for a side-effect. > > > > That is your personal preference. Objectively, there's nothing wrong > > with using 'if' that has no 'else' part. So changing someone's code > > to use 'when' where 'if' can do, or vice versa -- replacing 'when' > > with a single sexp in the body with 'if' -- has no real justification. > > Technically no, but I do hope not to be mistaken that there is a > convention (along the lines I gave above) here that goes beyond just my > personal preference. CLTL even says[p. 166]: It is fine for you to prefer this convention, but we don't mandate it in Emacs. > > Because if we add that to the code, we will need to maintain that for > > the observable future to be correct. Comments, even if they are > > outdated, don't need such level of maintenance. > > That could be resolved by either pinning a revision or instead of > cloning the repository to download a tarball of a tag. In fact that > should make the system even more stable than the way I see it being > promoted around the web currently, that just maps languages to Git > repository URLs. It can be resolved in more than one way, but all of them mean additional maintenance burden, so I don't think we should undertake that. > > Moreover, the fact > > that a given grammar was used for testing doesn't mean another grammar > > will not work as well. > > I don't know of any language with multiple independent implementations I do. Indeed, most have just one. But not all. > > Again, I explained the rationale many times here. I can explain > > again, but is that really necessary? > > You had previously said that you are opposed to raising an error (or am > I mistaken?), while the above comment says "we want this to signal and > error". No you are mistaken. We do want this to signal an error if tree-sitter is not compiled in or the grammar is not available. > > Help in reviewing patches when they are posted is also very welcome. > > It takes more than one pair of eyes to spot every bit that needs > > attention. > > I'll try and do so when I notice one. I have also been sketching out > support for a markdown-ts-mode to better understand the how tree-sitter > works, which could help. TIA.