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 8474 invoked from network); 14 Feb 2021 20:16:05 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 14 Feb 2021 20:16:05 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1613333765; b=Lt3vfcMH0r0SfFdpmnb/AZeQB55C2xguMmSiJ6twptrvGtBd6z3qJXc1lqJchmFferf1bX3BBj Rxub3iVraLjGWUn/EEUfs1yvwmE4AH5Le5WLSIuVHakBembBxOjZu4sG3Lms127n9rELRXnaQm 6yzrGS/+k/W+5u24ZAx0C9mVLSUTF/+xuoTMxMIFdGOFpbvOcmNxxSOVsb8nursQIZRhl/mGDY f38f6jG8GSPwf7hereP4bOAz1Om/zsEIlkY6MtLY6cGcWnhYvIcLtIsp+thgiSoHxHQu4NLqk1 wqDT+jmQNYesktf8aEtZ0XHsPrf9XM7g0iBhH1AvNdmmZw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ot1-f49.google.com) smtp.remote-ip=209.85.210.49; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1613333765; bh=6XQF+GG43nFQwKXNXx4vrBIaciJ8kho8xrQocjdjwiI=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=G/9slEyOQKSAAMhjkWPRyFo0oCdWWSe5ujJvAQM8bM4b/JVYLkgxlXo0E2ICBHMc+f8WeyvGfx sYHDy3fJOtPY6rdSaXsyKZ3LKO6Wu43cZHGDqKCW8bJGGWmwtItuRiaN9ZvIwd6N5SUEJLjiz1 J0VQpzaHh9ZMXKvJAO0i2mI1sK3Roqlp1XRT2HfzSms9wOxo5NcZkVkV0WEz6u3R0ILvBBzIqY qLLSYp3j7mzaeU9IyvzhqMfROHGR++tbM3QF/KVSci9wAEV95qOYWWK1lrYbRte2qTGmuCNt0v N0o0R7YmtbM3v+LZL9qXnUNXUygehwznH1C0yXgxVu0Phg==; 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:Content-Type:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=GMhyhBGIdmBU54I9HgYVAHG+KKCKakCf6UwwiLK6/VY=; b=k1asTFG7g3UmhDfX3sQnygT7Vn 3u3sIBX8+9BA0NdNV4G4/RS1MGkbWwlH0NRaIcYIoFqWJWdrLLuSZjdERv5cFctrrWbw9IEXc/63J VgLGOeEirIJxIrabd9FuQn5/a4dI+mcr9IUXRbiZHxp1tMt+h0FmVbQHP2yvSCwwxuzlqRyxSOxmz vVHXMGeub+5Tgip/18NZrrDJ2LlX/qDPwMjTfkcycDhTz/fD/9+ByCr0Fu7Yo8ggK5ubN1hst3uZm rJS3LZS4ozDUvZ6p+M4JQOUwzYinwKBuaj2LMawSbhCCYpoTdFdrkwU01A6JPkmVGy6AT3cVNqxSP hczyOmIg==; Received: from authenticated user by zero.zsh.org with local id 1lBNoJ-00036e-9H; Sun, 14 Feb 2021 20:16:03 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ot1-f49.google.com) smtp.remote-ip=209.85.210.49; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ot1-f49.google.com ([209.85.210.49]:45512) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1lBNo0-0002vo-79; Sun, 14 Feb 2021 20:15:44 +0000 Received: by mail-ot1-f49.google.com with SMTP id o12so4296241ote.12 for ; Sun, 14 Feb 2021 12:15:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=GMhyhBGIdmBU54I9HgYVAHG+KKCKakCf6UwwiLK6/VY=; b=bqNZcBYCBuQhfscKFWTWF3xO4uZFqQGgDPtSsDFUPEivTb2IJGaB/tHo8gY/l5SWbD YwtGf3p8DN3CZtUbtNFU0QGn1CBvHGA4qFaSWX/5tj3W6jhTXqCSmzZVNkV+GHvLZV59 Q1ubRtmOmto6Me2MKalev0hMMVu2lfmWMcbOjCZG2TT/oBxA9/HF6ReGojf0W7yVcc32 MiubmhsxIHZ6UTE/y7fI0NBb4xDJgTwdiiBYDjHwdyjfKt7a6SnlvnhPHxK5ZBKMm9/Q qNMYDNL4jsFFSkO/FaEyRjmngHZ2GvPRSzIwayjLzWsQjs3ZqrcHJtvAue1hjazhSExL N6PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=GMhyhBGIdmBU54I9HgYVAHG+KKCKakCf6UwwiLK6/VY=; b=ZoRTjVdTpJl9AAbhc0XQYy+Qg6T34tH3qWotCbIhpVqchgsB3eYJlI2alGXGgskXJu cYRP9L2QsXdzrxfQI1UaPNQ5dsLxKHPJmBQpnIWLFxyBLoNXOj9eQteCkGiawBkcsxsM Hu6bSGe7Qu1YOdDZUMkCkQLsgXHrEdMEaEvsggtVqhhs7QyNdd6p7jpiRfhnpPpqA6vK cyOdWC+F6jVZUnme/BycJR12CZ6piJFWpl+Bh0RIjDHZdUj2EWRDps7A0qb6Yt0omk0/ X7pD/ryHIHsd2NqpI6+B/SZMOeq3mfyuEtDtE6zeBDehECOmtS+wUVeeGUO52xFkgRTe H7Bw== X-Gm-Message-State: AOAM531G67yMb9lJA0PjAL9z7aUkbsWKJ/fIYRLY7fUZ07MOJRTN/u7p PGiLghA5m0ogPEAwRr+IEZsF+zR9gdlzFPngqJGOvp/vZZiOTaKX X-Google-Smtp-Source: ABdhPJw0BFA4x2D4+T6vnfhcUGJLlbKXebPFgSJDZVPYAv+TZB/mm8KEyS3Tsow1v8eHIuN8H1zAd3s/cgcSw8Uafo8= X-Received: by 2002:a05:6830:2106:: with SMTP id i6mr9131132otc.260.1613333742994; Sun, 14 Feb 2021 12:15:42 -0800 (PST) MIME-Version: 1.0 References: <20210213083521.kv3y3qzfnaffflfh@chazelas.org> In-Reply-To: <20210213083521.kv3y3qzfnaffflfh@chazelas.org> From: Bart Schaefer Date: Sun, 14 Feb 2021 12:15:31 -0800 Message-ID: Subject: Re: Block comments ala Ray To: Bart Schaefer , Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 48046 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: On Sat, Feb 13, 2021 at 12:35 AM Stephane Chazelas wrote: > > 2021-02-09 22:05:13 -0800, Bart Schaefer: > [...] > > !# This begins a block comment. > > This is merely rambling. > > This #! is the last line of the block > [...] > > - 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. > Also consider > scripts that do: > > cat > script < #! /bin/sh - > ... > EOF > > making it difficult to comment out those codes That one has some relevance, and argues for requiring #! to be followed immediately by a newline, if not also preceded by one. > - syntax is a bit obscure and uncommon. Intentionally so, yes. It has to be something that would essentially never appear in an existing script. > Would we allow blanks > before the !# for indentation purposes. No. > Would those !# be > recognised if the previous line ends in a \ or inside > heredocs? No, because it's handled by the lexer. It's not recognized anywhere any other comment isn't. > 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. > Would we allow escaping the closing #!? How? No, because you can't escape anything inside a comment. > - 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. > - <<# .. #>> allows inline comments, but looks more like a > redirection operator than a comment. That's why I rejected <# ... #>. > To me, there are more useful features that could be added to zsh > before that one. This is like saying we should solve problems on earth before we spend money on space exploration. It's a false dichotomy. > Or ksh's <#((...)), <#.. <>; redirection operators. The possibility of wanting to add those would also argue against using "<#" or "<<#" as a comment introducer.