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 11712 invoked from network); 13 Feb 2021 07:38:11 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 13 Feb 2021 07:38:11 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1613201891; b=rZDMGt5lizaE7R8KJaI10tkdoKN0tObpdM4b20YbNugfDHvmSycFCqqc5LCab8RddpGHHWlN6F 8AXIPEHQ2d7G848sMKSXpK+Ky4027bglyDvJIZIkdiVK+m9FJi1EI3VnlyfRPqCDeruGZuviM3 XMSYZbdmehY2cmvuaxeQfVsdKyaN5DNq7orbf9PzF+/padxRPm3tlolFj9+6wFOaENzCQPvEQB sKVf4U0c5c17Ipdx80Tk6j3VkmOvF04C8yftH3CeywS6TUDeAjuslCC7Hp7eu6USg/0Y9blBXw pglui5XOVjbGTkgSsFduxlo+RcYcwY40LxuOpI3uTaTMgw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (relay11.mail.gandi.net) smtp.remote-ip=217.70.178.231; 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=1613201891; bh=9EV0XBOmD7HEXKz544EcF1qfi04jxTB6s5xJPLFXBPg=; 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=HPDrBdtcx98bpSiO9jAs8l5TVJRvdPkYOqAGuqj7FINUYkpe9JTi0t6jEYTFLFr4sbUGTBQdnx BO/C96tGtm79vY6l6G9SkuMJxLieCOB62UT8iBotsKYa7LqckognbNDj6Dol6OtWhbxKr3/Zn3 ZHk2azmM0/yMizPBOBlFdPTkT6WrSnAKjerjQ5Oc6jYxQuBBtkZM8xdid32ckNez9RW1b+YYH1 eKno8MmL/ZnRnGiWvax0B4IpPsNSw8XFJ/Zj+SNB4G9YxrmS+3ym3Da+Q0rH7Gb6FStjzMmtqJ WkuFgHWmr/zm/ff325SgU/oitUfbIKXSgvUWA5CYhc3pNA==; 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=yHQMwcstvP6GgomQQbi5Am/3JFyYRoYxoImSDBGjVVE=; b=iAaQeE0y6vj1m+/ZDhhLiJvU/n t+lQhn3j+y9EZ96JKa/9bss3lIpuceomYp2dDLqT8iiRzerfI0+Mw6angYtpe9kw4IPzNaI9kTls2 2bqwrA8xr6Be8qW/20Mpai9x32Ud6do0nvx4z518WoybVLbBFfPZn2NtLEao5AwxT7Vvga00oN+12 UTAvb+f4JsM/98JkLL9RsC9utrh/Qln7h352hQnx+Ba7jKv3OK2+szFTfCQZOQRFQ3Oe53bge0nHA Pec5Mr06j8VpxF6xoE+7XHXF5xnr5zV1t5IO1UTuBDFaNE3evFuhHZzmUCVbn/8Cvk35TUtZj+d5m xq2SaNqw==; Received: from authenticated user by zero.zsh.org with local id 1lApVJ-000Med-25; Sat, 13 Feb 2021 07:38:09 +0000 Authentication-Results: zsh.org; iprev=pass (relay11.mail.gandi.net) smtp.remote-ip=217.70.178.231; dmarc=none header.from=chazelas.org; arc=none Received: from relay11.mail.gandi.net ([217.70.178.231]:42049) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1lApUy-000MUx-V7; Sat, 13 Feb 2021 07:37:49 +0000 Received: from chazelas.org (0547c5a9.skybroadband.com [5.71.197.169]) (Authenticated sender: stephane@chazelas.org) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 873C0100003; Sat, 13 Feb 2021 07:37:47 +0000 (UTC) Date: Sat, 13 Feb 2021 07:37:46 +0000 From: Stephane Chazelas To: Bart Schaefer Cc: Lawrence =?utf-8?Q?Vel=C3=A1zquez?= , "zsh-workers@zsh.org" Subject: Re: Block comments ala Ray Message-ID: <20210213073746.z2ruehp5jw7l55ry@chazelas.org> Mail-Followup-To: Bart Schaefer , Lawrence =?utf-8?Q?Vel=C3=A1zquez?= , "zsh-workers@zsh.org" References: <20210212074031.7746vg37xykniem5@chazelas.org> <20210212154547.iy35rp4ijaef22ld@chazelas.org> <20210212210236.rsmrs65lmtxzoqzc@chazelas.org> <20210212211235.wceitj3w5qr4bv3x@chazelas.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Seq: 48037 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-12 13:29:48 -0800, Bart Schaefer: > On Fri, Feb 12, 2021 at 1:12 PM Stephane Chazelas wrote: > > > > But still, the comments appear not to be discarded at that point: > > > > $ zsh -c $'f() { echo $(echo x # comment\n); }; typeset -f f; f' > > f () { > > echo $(echo x # comment > > ) > > } > > x > > The literal text of what's contained in $(...) is retained [...] You're right. It looks like the contents is parsed (I suppose to be able to handle the case x in x)... and the like inside), but the result of that parsing seems to be discarded, and it seems the contents of that $(...) is parsed again each time the function is invoked. ksh93 does appear to do the same. bash as well, but it's unclear to me what kind of parsing it does in the first round. See for instance: $ bash -xc 'echo $(foo case a in a); esac)' ++ foo case a in a bash: foo: command not found + echo '; esac)' ; esac) -- Stephane