From mboxrd@z Thu Jan 1 00:00:00 1970 From: Byron Rakitzis Message-Id: <200207270243.g6R2hMc04796@rakitzis.com> To: 9fans@cse.psu.edu Subject: Re: [9fans] bug or a feature? Date: Fri, 26 Jul 2002 19:43:22 -0700 Topicbox-Message-UUID: d4e5a90a-eaca-11e9-9e20-41e7f4b1d025 >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.