zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: curiosity with here document.
Date: Thu, 26 Nov 2015 18:29:32 -0800	[thread overview]
Message-ID: <5657C00C.2010401@eastlink.ca> (raw)
In-Reply-To: <151126175625.ZM22214@torch.brasslantern.com>

On 11/26/2015 05:56 PM, Bart Schaefer wrote:
> On Nov 26,  3:19pm, Ray Andrews wrote:
> }
> } lesson learned.
>
> Except it's the wrong lesson!
Well no, it is a lesson to be careful trying to use here-docs to comment 
blocks. As to why it goes off the rails, I was close to understanding it 
anyway--I'd expect legal code like that to have some sort of truth 
value, inconvenient as it may be.  I'm not really surprised by the 
correct understanding.
>      function three_commands {
> 	command1; command2; command3
>      }
>      if three_commands; then ...
Sure, but in practice I don't think we see that sort of 'list' after an 
'if' very often.  It seems that only the truth value of the last 
statement is acted upon as far as any 'if-then' structure, so as I said, 
the original 'if' seems to be orphaned.  So what?  It's me put the 
parser into that strange position, I'm not bitchin', it did what it had 
to do. Don't want orphan tests?  Don't make them.
> And second, that [[ ... ]] is just a command like any other command,
> it's not magically connected to "if".

That's the sort of fact that one might think one understands without 
really understanding it.  I probably can't hardly help C-ing it the C 
way.  I appreciate these deep corrections.
> And third, that a here-document is just the standard input of the
> command it follows, so
>
>      : <<END
>      some stuff
>      END
>
> is (again for purposes of determining truth value) the same as
>
>      :

Yeah, I'm really not as thick as I seem about this.  Wanting the 
'comment' to be available at any point wasn't realistic. Not one of my 
better questions.

BTW, I wish there was a way of going back to the archives and deleting 
lousy questions, I'd sure cut out a pile of mine. Library of Babel.


      reply	other threads:[~2015-11-27  2:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-26 18:37 Ray Andrews
2015-11-26 19:01 ` ZyX
2015-11-26 19:03 ` ZyX
2015-11-26 23:19   ` Ray Andrews
2015-11-27  1:56     ` Bart Schaefer
2015-11-27  2:29       ` Ray Andrews [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5657C00C.2010401@eastlink.ca \
    --to=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).