9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Byron Rakitzis <byron@rakitzis.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] bug or a feature?
Date: Fri, 26 Jul 2002 19:43:22 -0700	[thread overview]
Message-ID: <200207270243.g6R2hMc04796@rakitzis.com> (raw)

>i'm happiest with
>
>        if foo
>                bar
>        if not
>                baz

Maybe someone can settle this for me.

I found "if not" an atrocity because it's not something lexically
scoped. This is apparently legal rc according to the grammar:

	if not foo
	if not bar
	if not baz

It's up to the interpreter to flag it as an error.

Granted there are many "runtime" as opposed to "parse" errors which
rc will flag for you, but it strikes me as singularly awful that the
control structure of the language should be one of those things.

Also, without thinking really hard about it, I'm not sure how
if not would work for nested ifs. Does this work the way you
would expect?

	if (foo) {
		stuff
		if (bar) {
			more stuff
		}
	}
	if not {
		!foo stuff
	}

A peek at the plan9 rc source suggests there is a global variable
called "ifnot" which makes me very, very nervous. But I don't run
plan9 at home so I can't test this code sample. What if foo is true
and bar is false?

TD was justifiably proud of rc's yacc grammar -- I suppose I felt I
was doing it one better by bringing "if .. else" under that umbrella
also.

Byron.


             reply	other threads:[~2002-07-27  2:43 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-27  2:43 Byron Rakitzis [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-07-27 20:30 Byron Rakitzis
2002-07-27 12:10 presotto
2002-06-13 23:05 Russ Cox
2002-06-13 23:23 ` Dan Cross
2002-06-13 20:35 Russ Cox
2002-06-13 20:58 ` Dan Cross
2002-06-13 21:34   ` Tharaneedharan Vilwanathan
2002-06-13  3:41 Russ Cox
2002-06-13  1:01 Russ Cox
2002-06-13 17:40 ` Dan Cross
2002-06-12 23:49 Geoff Collyer
2002-06-13  0:07 ` Dan Cross
2002-06-13  0:31 ` Pavel Mihaylov
2002-06-13  2:29 ` Lyndon Nerenberg
     [not found] <dmr@plan9.bell-labs.com>
2002-06-12 19:57 ` Dennis Ritchie
2002-06-12 20:16   ` Scott Schwartz
2002-06-12 19:52 andrey mirtchovski
2002-06-12 21:57 ` Dan Cross
2002-06-12 22:53   ` Lyndon Nerenberg
2002-06-14  8:45     ` Douglas A. Gwyn
2002-06-14 16:23       ` Lyndon Nerenberg
2002-06-12  9:15 forsyth
2002-06-13  9:29 ` Douglas A. Gwyn
2002-06-11 15:32 Russ Cox
2002-06-11 15:29 rob pike, esq.
2002-06-11 21:05 ` andrey mirtchovski
2002-06-11 21:19   ` Ronald G Minnich
2002-06-12  5:17     ` Lucio De Re
2002-06-12  8:53 ` Douglas A. Gwyn
2002-06-11 15:26 andrey mirtchovski
2002-06-11 15:14 andrey mirtchovski

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=200207270243.g6R2hMc04796@rakitzis.com \
    --to=byron@rakitzis.com \
    --cc=9fans@cse.psu.edu \
    /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).