Zsh Mailing List Archive
Messages sorted by:
Re: indented heredocs
- X-seq: zsh-workers 40246
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: indented heredocs
- Date: Thu, 29 Dec 2016 18:56:29 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=AKEkx4w/Jr4ZHKKX6XC88RimkDpTa9+S7kAgOvwAwsI=; b=EFClCKmjtEIggFXxWeMMyZw9hiOkdpxQyU/95tqtx0GdFy0rWQK8QY91GmO4Lv1J+D kSsct9jX6G4t0C6mQvWuadpJr7VLjohHMGKbdfkCZ0Srn0/Denp6+ZGAsH9CvfqcfPcY Qo1jIZLRaNmlqJwWbGCjDKMCf99k9Fqu8v4vgW0JH8GlfOQZLLOQNiz5H8UKOzfKhMYN wbw4dmidl5kt627sOA24Cam+eBKhQSBm7ajPn4jj4uT4qJBbNCiiOmcsSlbvERgSwhVg 2+ttEajZhcfIsX2hcwR5VKdVEZ6wIQoNS+/1Zet5uFIcZq9pUG2ob1qhntwwHoA4IG4+ Jo+g==
- In-reply-to: <firstname.lastname@example.org>
- List-help: <mailto:email@example.com>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CFA2339B-26F2-4104-AAD2-64852509286B@yost.com> <CAH+w=7bGEb13SUxX-whdHzWRktoiMdvgSosJvcEoZ+t0z3FOhA@mail.gmail.com> <email@example.com>
On Dec 30, 1:31am, Nikolay Aleksandrovich Pavlov (ZyX) wrote:
} 22.12.2016, 01:11, "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>:
} > I would propose instead something similar (read on below) to this:
} > % cat <<-' xx'
As has already been pointed out, this can't be used exactly as-is,
because quotes around the end marker already have semantics.
} This makes changing the indent rather tricky.
Well ... it means you have to both change the indent and declare that
you've changed it. I wouldn't call that "tricky".
} YAML does better here: amount of stripped indent is either determined
} based on the first non-blank line [...]
This is at least feasible. (Does "non-blank" mean "contains a character
that is not whitespace"? What's whitespace?)
Would we want to strip leading space and tab, or e.g. leading $IFS (with
the probable exclusion of the set $'\f\n\r\v' in that case)?
} or is specified explicitly, relative to the indent of the line where
} block scalar starts
Now that latter I *would* call "tricky" -- a numeric count relative
to some other indent? What if some of the leading whitespace is tabs?
Also if I read the rest of your explanation correctly, this would make
signficant the leading whitespace before the command whose input is
being redirected, which is a non-starter.
} YAML uses `|` and `>` to start block scalars, that's why I used
} `|` above (`<<>` seems odd and may be confused with `<>`). Not
} sure why this should be a bad choice: `|` already has different
} meanings in different contexts
It seems a bad choice to me because of >| and >>| which have a very
different meaning. If we were going to use either <| or <<| for some
special purpose, it feels as if there should be symmetry implied, as
with e.g. <& and >&.
Of course << and >> have already given up that sort of symmetry except
for one being input and one being output, so ...
This reminds me that both <<; and <<& also are currently bad syntax;
though "<<;" is probably an even worse choice than "<<|". There is
at least precedent for combining one of "|" or "&" with redirection.
Messages sorted by: