9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] p9p rc flag e +
Date: Thu, 21 Mar 2013 11:27:15 -0400	[thread overview]
Message-ID: <7951e6b417d53eed0e3f8cecb0d74e7b@ladd.quanstro.net> (raw)
In-Reply-To: <30310135.BKH1Es4pAj@coil>

> i'd rather have if's $status visible only to the first statement following it,
> for example:
>
> if (foo | bar | baz) {  # sets $status
>   if (! ~ $status ....) {  # uses $status
>     handle_particular_kind_of_pipeline_failure
>   }
>   do_other_stuff   # should not be affected
> }
> do_yet_other_stuff   # should not be affected either
>
>
> ...but guess rc's semantics are almost set in stone by now :-)

the status is only visible to the first *executed* statement.
remember, rc at heart is a virtual machine.

since the argument of if is always executed before the branch,
the status of cmd1 in "if(cond)cmd1" is by definition ''.

to take this to its logical conclusion, consider this code

	if(~ 0 1){
	}
	if not{
	}
	echo $status

it prints "no match".

- erik



      reply	other threads:[~2013-03-21 15:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-21 13:29 dexen deVries
2013-03-21 14:22 ` erik quanstrom
2013-03-21 14:58   ` dexen deVries
2013-03-21 15:27     ` erik quanstrom [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=7951e6b417d53eed0e3f8cecb0d74e7b@ladd.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /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.
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).