From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 266 invoked by alias); 21 Dec 2016 20:38:36 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 40222 Received: (qmail 265 invoked from network); 21 Dec 2016 20:38:36 -0000 X-Qmail-Scanner-Diagnostics: from mail-pg0-f53.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(74.125.83.53):SA:0(-0.0/5.0):. Processed in 2.442024 secs); 21 Dec 2016 20:38:36 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: daveyostcom@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 74.125.83.53 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:mime-version:subject:date:references:to:in-reply-to :message-id; bh=1PxlY5SjN0oh+WeYlEZqbMSP851/9rwzLgK9gOfthdY=; b=ptb2g1piPttmClEHDwzyzIZ8tjBhOvuRhPqYHo5YbbPc0OckP+BBsj2/T0E5P325ff kS/PEogaVZBRQddfBrtOsuNaApK+r6KxYJtCDMhPlfTUHaCUL4LKJI2vnL+EkNV9Z3tH URVJuTM2f6B3p8yoxYyaH7aCd+x1ZT7wGd8Fm5z2QDhZQmJntmqBX5vEC6z2c4kYl/Tk /HtyreMhf2TZ0kj/n524dYL+8aXRaFH0FUoNp+2pI2WiAI4HDyCoRdWHcuPrdqFGRVyW vzu1XMWKB42G8l0dKHNtOChcatePg1iPkllavsQujYquAFX55WL8mtChg5VamVnaIF94 s+eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:mime-version:subject:date:references :to:in-reply-to:message-id; bh=1PxlY5SjN0oh+WeYlEZqbMSP851/9rwzLgK9gOfthdY=; b=ZuFrA2jiTL7+GoYwGs+Vl9VEOpY1DJ52YriY0tJJv0OAqRbr4qn5E/USGL0oi4MJO1 h6QC8eb7jaye3ZTbFLhXNRUiSsqsQX28nXKkuGoSogmpbNyGxpiJQm84+LYTX5PFlFqO FXAgeVEG38kjkrcT3BBwQwxZamAketkgFm+5nKL3uMsVZeSWIGAX7m+GfMhWO8KrDxaY Xl1p/YXiyvu2G5eeKxWs6tzT/xftDFrkPhMYccLVgWBbIjDmc4aZFbzSsgYVDTtVozcf kd0YdmesQaMSzN0GFPajoT5f3Hury6Rr/Qyng/0lU1P3fF9yOarTXDwHB47ay0odicio /MpQ== X-Gm-Message-State: AIkVDXLqBgK9wf+uP3TwKlLrnfXCPPNuH0iSeSO6FGt7+TPCJXtFESxOKzJzwgSg/M1g+A== X-Received: by 10.99.241.21 with SMTP id f21mr10777523pgi.110.1482352701364; Wed, 21 Dec 2016 12:38:21 -0800 (PST) Sender: Dave Yost From: Dave Yost X-Google-Original-From: Dave Yost Content-Type: multipart/alternative; boundary="Apple-Mail=_8D574396-059E-409E-AD70-D40EACD866E7" Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Subject: Re: indented heredocs Date: Wed, 21 Dec 2016 12:38:19 -0800 References: To: zsh workers In-Reply-To: Message-Id: <3FB2A6AE-B242-4F34-99C8-17381640816B@yost.com> X-Mailer: Apple Mail (2.3259) --Apple-Mail=_8D574396-059E-409E-AD70-D40EACD866E7 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 I should mention that <<- is defined to remove all leading tabs in the = heredoc, so you get this: 0 Wed 12:34:44 yost DaveBook ~ 215 Z% cat <<-xx heredocd> a heredocd> b heredocd> xx a b 0 Wed 12:35:35 yost DaveBook ~ 216 Z%=20 so if you intended the line containing =E2=80=9Ca=E2=80=9D to have a = leading tab, you will not get what you want. This is a misfeature IMO. Also: the examples below don=E2=80=99t show the =E2=80=9Cheredocd>=E2=80=9D= prefix because I pasted the entire input into the terminal before = hitting return. Dave > On 2016-12-21, at 11:29 AM, Dave Yost wrote: >=20 > Today we have this: >=20 > 0 Wed 10:53:18 ~ > 204 Z% cat < foo > bar > xx > foo > bar > 0 Wed 10:53:33 ~ > 205 Z%=20 >=20 > Surely people have thought of this (Alternative 1): >=20 > 0 Wed 10:53:53 ~ > 205 Z% cat < foo > bar > xx > foo > bar > 0 Wed 10:53:53 ~ > 206 Z%=20 >=20 > but shells don=E2=80=99t do that. >=20 > I ran this idea by Steve Bourne and asked him why indenting was not = allowed. >=20 >> I never considered the indent idea. It's a good idea although I = don't like the idea of post processing the temp file to remove the=20 >> leading white space. I agree the way it is now is not easy to look = at, and I can't think of a way to have the ident amount specified >> in advance of reading the document. >=20 >=20 > BTW, of historical interest, he also said he stole the heredoc idea = from somebody else at Cambridge = . >=20 > I suggested this (Alternative 2), which he liked: >=20 > 0 Wed 10:53:53 ~ > 206 Z% cat \ > < foo > bar > xx > foo > bar > 0 Wed 10:54:10 ~ > 207 Z%=20 >=20 > He also suggested >=20 >> You could find another symbol after < Right now > are available which now would cause syntax error. >=20 >=20 > I don=E2=80=99t think that would help anything. If the parser = doesn=E2=80=99t know how to do the new syntax with the existing << = operator, you=E2=80=99ll get an error, and if the parser doesn=E2=80=99t = know the new operator, you=E2=80=99ll get an error. Same difference. >=20 > I propose Alternative 2. >=20 --Apple-Mail=_8D574396-059E-409E-AD70-D40EACD866E7--