Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!ucsd!swrinde!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!uunet!midway!quads.uchicago.edu!goer From: goer@quads.uchicago.edu (Richard L. Goerwitz) Newsgroups: comp.lang.icon Subject: Re: alternation surprise Message-ID: <1991Mar12.235558.1542@midway.uchicago.edu> Date: 12 Mar 91 23:55:58 GMT References: <1899@hslrswi.hasler.ascom.ch> Sender: news@midway.uchicago.edu (News Administrator) Organization: University of Chicago Lines: 31 Na@hslrswi.hasler.ascom.ch (Norman H. Azadian) writes: >I know my postings are starting to sound like an idiot's tour >of Icon. If you want a real laugh, try taking a look at icon-group traffic from, say, three years or so ago (when I was still just learning the language). The archives are on cs.arizona.edu (much to my chagrin :-). > > procedure main() > local flag, x > flag := 1 > (\flag) | (x := runerr(500)) > (\flag) | x := runerr(500) > end > >This dies on line 5, which I did not expect. I guess alternation >has lower priority than assignment. Pardon me while I go out and >stock up on parenthesis. My golden rule, for a long time , was "conjunction has the lowest prece- of any infix operation." Everything else I parenthesized. You may find that the precedence of alternation makes more sense if you think of the very common idiom - intext :=open(\filename) | &input -Richard