From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 7ae8114d for ; Thu, 15 Aug 2019 14:28:55 +0000 (UTC) Received: (qmail 7434 invoked by alias); 15 Aug 2019 14:28:45 -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: List-Unsubscribe: X-Seq: 44667 Received: (qmail 26443 invoked by uid 1010); 15 Aug 2019 14:28:45 -0000 X-Qmail-Scanner-Diagnostics: from st43p00im-ztdg10061801.me.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25538. spamassassin: 3.4.2. Clear:RC:0(17.58.63.170):SA:0(-4.3/5.0):. Processed in 1.651779 secs); 15 Aug 2019 14:28:45 -0000 X-Envelope-From: whereislelouch@icloud.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at icloud.com designates 17.58.63.170 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1565879288; bh=U6Os6bHjXWrpKDIvVgQYcAnQdrpT7Owy6yZGGnps43k=; h=Content-Type:Subject:From:Date:Message-Id:To; b=jYFlgxMpjDb4GxDfBuE3jVQXQAQo7ueU1iN/Z42zuqP1nibaosZVLaaHJ1ImMP2y6 cfyJ17A/hDQSSolzyew8yY3phFpLGdtROuXDmYrh9VcSRcjxR7vhaXPqkuB6JoyxnV H88EfbIhjKwxQcWAmt2XdMetSISyt3rkQRSWZS45tBLP9fEI7g7uhBUZPohNiikRZY RJST/l6om7+FsyJFxvF8HBcMEazxk+eNWXZabd0cooPpT/CgPvOVo0sxGq0vD//1Kn YGFjPuNn8YoGfRa5dCdAebJW/GJ5pYfmLwheudd3xp+cPvFAQb4IkwM3ljCxejn04G /mOrOZk246c6A== Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: [Feature Request] Adding option to support triple quotes From: Aryn Starr X-Mailer: iPad Mail (16F203) In-Reply-To: <20190814095449.s7mgevyo5tdhfyby@chaz.gmail.com> Date: Thu, 15 Aug 2019 18:58:04 +0430 Cc: zsh-workers@zsh.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <6EA30061-5610-4CCA-93FB-0A160E2002A3@icloud.com> <20190814095449.s7mgevyo5tdhfyby@chaz.gmail.com> To: Stephane Chazelas X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-08-15_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1812120000 definitions=main-1908150147 That EOF solution is good if there is a lot of text, but for short snippets,= it=E2=80=99s too many characters to type. Completely against the shell=E2=80= =99s spirit of arcane brevity. :)) I also thought of a (kind of) new application for the triple quotes. I think= it=E2=80=99ll enable a lot more functions like this: cc() python -c "from math import *; print($*);" Since we=E2=80=99ll be able to easily write the target language=E2=80=99s co= de in our shell, with minimal typing. > On Aug 14, 2019, at 2:24 PM, Stephane Chazelas wrote: >=20 > 2019-08-13 10:36:53 +0430, Aryn Starr: >> Adding an option to zsh to support triple quotes >> (TRIPLE_QUOTES) would make possible much more readable code. > [...] >=20 > We could also implement mksh's "$(<<'EOF' > arbitrary text that mustn't end in empty lines > EOF > )" >=20 > That already works in zsh, but is not optimised like in mksh as > it does "$(cat <<'EOF' > arbitrary text that mustn't end in empty lines > EOF > )" while mksh treats it specially as effectively a kind of > quotes. >=20 > mksh also supports $(<<'EOF' > foo > EOF) >=20 > (though that's probably not POSIX). >=20 > See also perl's q(...) and qq(...) that are more compatible with > the shell syntax than those python '''/""". >=20 > See: >=20 > $ a=3D"'"; print -r ${(qq)a} > ''\''' >=20 > --=20 > Stephane >=20 >=20 >=20 >=20