Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!TARDIS.CRAY.COM!cargo From: cargo@TARDIS.CRAY.COM (David S. Cargo) Newsgroups: comp.lang.icon Subject: generation of procedures Message-ID: <9002071557.AA01397@zk.cray.com> Date: 7 Feb 90 15:57:47 GMT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 47 I was looking at the code for RSG (part of the Icon Program Library), noticing how one part of the code takes advantage of the order of a list of procedure variables to successively try evaluating a line of input until one of the procedures succeeds. My first reaction was that this reminded me of searching an object hierarchy looking for a handler for a particular type of message. If a particular object can't handle the message, it fails and lets the object next higher in the hierarchy have a crack at it. It sort of reminded me of message passing, but with a distinctively Icon flavor to it. My real question is that I can't figure out how to decide what the symantics of the operation really are. Normally I would expect to say the !plist comes as element generation, which should succeed when the first element is generated. But then it is followed by a parameter list and surrounded by parentheses. This seems to combine to make it an alternation expression equivelent to: (define | generate | grammar | source | comment | prompter | error)(line) plist := [define,generate,grammar,source,comment,prompter,error] : : while in := pop(ifile) do { # process all files repeat { writes(\prompt) line := read(in) | break while line[-1] == "\\" do line := line[1:-1] || read(in) | break (!plist)(line) # the line above is the interesting one! } close(in) } I can't seem to find anything in the Icon book that spells out what is really happening here. It looked at first like !plist wasn't in a context that required generation of all the list elements, but clearly that is not the case. The confused snail, o o \_____/ /-o-o-\ _______ DDDD SSSS CCCC / ^ \ /\\\\\\\\ D D S C \ \___/ / /\ ___ \ D D SSS C \_ _/ /\ /\\\\ \ D D S C \ \__/\ /\ @_/ / DDDDavid SSSS. CCCCargo \____\____\______/ cargo@tardis.cray.com