On Mon, 2007-01-01 at 12:26 +0000, James Wilkinson wrote: > Aaron Konstam wrote (about COMEFROM): > > This joke is about 30 years old. It has been has been so long since it > > was first mentioned that it is hard for me to explain clearly why this > > is indeed not compilable but it is not. > > I guess if one can't explain something clearly one should shut up. It > > leads to situations which are logically unresolvable. As someone who has > > taught compiler construction it should be obvious to me why this is true > > but my senior moments have caught up with me. If the detailed > > explanation comes to me I will share it. > > As I understand it (and I'm certainly not a compiler expert): > > Computer languages do have to be well defined. If you have something > like (pardon the pseudo-BASIC): > 10 PRINT "Hello." > 20 COMEFROM 40 > 30 PRINT "How to exercise a CPU in three instructions!" > 40 PRINT "Normal definitions of COMEFROM say this will never be run..." > 50 QUIT > That *is* "compilable" since you can come up with a "valid" binary that > does what the programmer expects. > > If on the other hand you have > 10 PRINT "Hello." > 20 COMEFROM 60 > 30 PRINT "Schrödinger may or may not have been here..." > 40 COMEFROM 60 > 50 PRINT "but he *was* here!" > 60 QUIT > what happens when you get to line 60? Should the program restart from > line 20 or line 40? With normal, single threaded programs, it's not > possible to do both, so you can't get a binary that does. Therefore it's > not compilable (without extra definitions). > > Suggested workarounds include returning to different COMEFROMS at > random, or starting different threads (or forking new processes), one > for each COMEFROM. > > James. Thanks James. I had a response (more complex) worked out but your example explains the problem quite clearly. I am embarrassed that I drew a blank in doing this immediately. -- Aaron Konstam <akonstam@xxxxxxxxxxxxx>