From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 2155 invoked from network); 15 Feb 2021 17:44:18 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 15 Feb 2021 17:44:18 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1613411058; b=e+F+wSp0Al6/A4U1D+WmVA7zviwLxptLJmK2QHe2gaCsK2DVDnArNZ81tp4uO5UwdrNJOjXi+e lVMkwW372atIoAke/1K6w7LePulCPTifRF6E0IM+Ih+eOE+UE2HsCCfZxcIqiAcohaXss2+Jgt Mk/TqP4MMmoVBSBzgyEVXPh1Lvifd/kvTgAnzA6kJL1ZYBwogM14XAXsSnevM3twqbqBGoucsk TF6v00s09Usre7WK670lvb93eQ7XU90TTQNKUy3OetQxCnqStwGv52118UT4c4EBxtdrdw7SJx jfg3JCvD8cKo5nFwB712twWc2slaVfY3x1zxfPFkT54ssg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (relay8-d.mail.gandi.net) smtp.remote-ip=217.70.183.201; dmarc=none header.from=chazelas.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1613411058; bh=5tUsq9vbO/M6bo+63uOmCqnre2bzIFR0bivzyNrJnA4=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:DKIM-Signature; b=caXR7WUKRcg21G9lQLLqT/2SrYT9WIB2Mzvyx8UMO1dPu58ywYTVUIciQ4/6innp/L6nAm67a1 2eGNxr1UlFx2Ut/VE6F25CmSACZNzplz+MhA7SlO3hdgSHBjItAqRkdlrsCWfLX9n23xmZrQhR 3HxKN3uuOxnYTelCzhFWPbhF6eQgDKoLg8/bZ1OlLre+XCJKSJzNmkT3HnU4Q328XyRQ0cj9RY zWbeydl8dHUqXS07kv+vGo580RydylDCA/on8ZDLts5WxYXp+MdxrAte9TENMTiXa58uuCzZck tvzOxN4HV6o8fCBWKY0E4PJgXNP9xpAJ6RmbU9TgBKtKFQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=CwB4GtNAd5ErCBn60fUhueKUwV/jNaGJTu/M6eUaSvs=; b=N1p6ciylebZRxYiIiXlw5/O+Fc gEJPlGmhulUBR+DMyHsZkdKM74TxIHEl/V4lc5SoqzQ1uwEXbcpBZtgZuI52VlGGJdvTzqAYhjvVs /DDq5Oc63EFKzV02d7yKZ0j2gKaPyulzE+FcXBXCZ9fyxq6ZgUAJS/fIB2Zsul03X5LhvDSYNfJO8 zwsObiKsaJeR6z+ZemOIbfsflo0Nbn0ue+rpIiQue7prI18nncoAaletuVVdpmQ1NUsuOOC+L0NeR I8WCCP35jiBNBTewR19vsRAlJ1BERdEKcAEpFt6HoDMqNLV98pn5p2caK3XucH8Cdz2UuNfixV1t+ pfJSNGvQ==; Received: from authenticated user by zero.zsh.org with local id 1lBhv0-000Fug-60; Mon, 15 Feb 2021 17:44:18 +0000 Authentication-Results: zsh.org; iprev=pass (relay8-d.mail.gandi.net) smtp.remote-ip=217.70.183.201; dmarc=none header.from=chazelas.org; arc=none Received: from relay8-d.mail.gandi.net ([217.70.183.201]:59919) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1lBhug-000FkE-UW; Mon, 15 Feb 2021 17:43:59 +0000 X-Originating-IP: 5.71.197.169 Received: from chazelas.org (0547c5a9.skybroadband.com [5.71.197.169]) (Authenticated sender: stephane@chazelas.org) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 155441BF203; Mon, 15 Feb 2021 17:43:56 +0000 (UTC) Date: Mon, 15 Feb 2021 17:43:56 +0000 From: Stephane Chazelas To: Bart Schaefer Cc: Zsh hackers list Subject: Re: Block comments ala Ray Message-ID: <20210215174356.7kcrfk247j5vrg3y@chazelas.org> Mail-Followup-To: Bart Schaefer , Zsh hackers list References: <20210213083521.kv3y3qzfnaffflfh@chazelas.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Seq: 48056 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: 2021-02-14 12:15:31 -0800, Bart Schaefer: [...] > > - those !#, #! look too much like a shebang. > > Which actually doesn't matter, because #! isn't special anywhere but > the first line. > > > - !# is already histsubst syntax. > > Also doesn't matter, this was intended only to operate where history > is disabled anyway. > > > - It's also the !# extendedglob > > You mean "zero or more occurrences of '!' "? This is another reason I > was only allowing "!#" at the start of a line. Under what > circumstances would you begin a new line with that glob? > > > - It's also (POSIXly) invoking the !# command. > > Yes, I mentioned that. It seems pretty damn unlikely to use that, as > it has no effect other than to set $? to 1. Those were more objections on style ground than to say it was an incompatible change. I can imagine someone seeing: !# some code #! end And thinking "is that remnants of mistyped shebang?", "why 0 or more !s?", "what's that history expansion doing in there...?". [...] > > - syntax is a bit obscure and uncommon. > > Intentionally so, yes. It has to be something that would essentially > never appear in an existing script. I rather meant "something that one would not readily associate to a block comment", though I'll admit that none of the alternatives I suggested are any better. [...] > > Does it have to be delimited with whitespace? Can we > > use !########### .. ##############!? That ! is easy to miss. > > Those are among the reasons I didn't think forming "inline comments" > was a good idea. [...] > > - assuming we allow nesting (which would be useful to comment > > out sections of code that contain block comments), > > I hadn't considered nesting. You can't nest C /* ... */ comments, and > this was not intended to work any differently. But the only use I can imagine for those !#...#! block comments are to comment out code. That's why you use #if 0 in C for that (so you can comment out code that contains comments). I wouldn't use those for commenting (for inline documentation), just like in C, we use /* * multiline * comment */ For long comments as comments formatted as: /* multiline comment */ make the code less legible as it's less clear what is code and what is comment. I could use a C-like comment that allows me to do things like: rsync -v --inplace \ --stats -xazAX --delete \ --numeric-ids !# don't want the dependency on NSS #! \ --hardlinks Though at the moment, we can already do: rsync_options=( -v --inplace --stats -xazAX --delete --numeric-ids # don't want the dependency on NSS --hardlinks ) rsync $rsync_options [...] > > Or ksh's <#((...)), <#.. <>; redirection operators. > > The possibility of wanting to add those would also argue against using > "<#" or "<<#" as a comment introducer. Yes, that's why I didn't suggest <#. And also why I brought up those ksh93 operators, to suggests there are more lexer changes that we may want to add to zsh in the future. Here, if it was my call, I would just not bother with a new block-comment operator, at least not until one gave a good reason why they would be useful and better than what we already have. -- Stephane