From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.devel Subject: Re: Code quality of some -ts-mode major modes Date: Fri, 17 Mar 2023 15:49:15 +0000 Message-ID: <87h6ujjs3o.fsf@posteo.net> References: <87fsa3g05n.fsf@posteo.net> <87bkkrft9n.fsf@posteo.net> <83a60beb5a.fsf@gnu.org> <87v8izjtf2.fsf@posteo.net> <835yaze6o6.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17738"; mail-complaints-to="usenet@ciao.gmane.io" Cc: ruijie@netyu.xyz, casouri@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Mar 17 16:50:08 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 1pdCLH-0004NW-UY for ged-emacs-devel@m.gmane-mx.org; Fri, 17 Mar 2023 16:50:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pdCKd-0000uc-LN; Fri, 17 Mar 2023 11:49:27 -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 1pdCKX-0000uA-FB for emacs-devel@gnu.org; Fri, 17 Mar 2023 11:49:23 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pdCKV-0006lG-94 for emacs-devel@gnu.org; Fri, 17 Mar 2023 11:49:21 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 0AE902406D8 for ; Fri, 17 Mar 2023 16:49:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1679068157; bh=ZCiOLrfzLge93YOg4wX6Lqh7BAVPTVm6T8iKiEAppNQ=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=EISfVbxXL6F92xt4BWBy4pMZMY63Q0G2dq3ERGKYGYd1SwaVBV5nqNMiLuJ7BjOrk hpZkVcVd16uG4/Sssz+hwAhvdAk63tJAWDhuSVbvMEnncA3hK7ozOz4Y6b93uNoWxb kbdxy3bEyuS4zneVNNO5ZiFBr9+8la7i78jEmIKolVxQPoL3gH50qCg52nBFtSpxYs 8zRcYcCCqiCOs18YsBmiKSq0BtAOWW+nzRPqZx9x0G78166qLQlLcMiZO0jdUxwhXG 8CiI2ijq8954mlQQqeoBH5nZvLNbCz6ePYCuEw8eC0pkKmZ6q5kZl9IhIKFxSVzyus NG5+6mXqgTGdA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PdT8D2YyCz6tm4; Fri, 17 Mar 2023 16:49:16 +0100 (CET) In-Reply-To: <835yaze6o6.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 17 Mar 2023 17:31:05 +0200") Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, 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.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:304554 Archived-At: Eli Zaretskii writes: >> 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. Ok, in that case I was mistaken. I have just seen a number of commits that either just or also made this change, making it seem like established knowledge. >> > 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. If you think so, but at least we agree that one reference to a grammar would be helpful. >> > 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. Could you give me an example that I could try out? >> > 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. But it doesn't, or am I completely oblivious that (treesit-ready-p 'something-i-just-made-up) just displays a warning? The way I am currently reading/seeing the code is that if tree-sitter and the grammar are available, then it will be initialised but otherwise we just get a warning and a pretty plain mode. >> > 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. -- Philip Kaludercic