jack@mcvax.uucp (Jack Jansen) (06/30/86)
In article <155@daisy.warwick.UUCP> cudcv@daisy.warwick.ac.uk (Rob McMahon) writes: >In article <523@ccird1.UUCP> rb@ccird1.UUCP (Rex Ballard) writes: >> >>if (5<a<50) do_something(a); >> >... >> >>Is this impossible to parse? > >This was in BCPL, and was a GOOD IDEA. Yes, it is nice from a users standpoint, but if you want to define the semantics of this operator in a reasonable way, it becomes difficult. The only way out I see is to let expressions have *two* values: an ordinary one, and a success/failure indication. Then you can let the value of 'a<b' be 'b', and the operator return 'success' when a is less than b. I remember seeing something about a language that had such semantics, can't remember which one, however. -- Jack Jansen, jack@mcvax.UUCP The shell is my oyster.
steve@jplgodo.UUCP (07/10/86)
In article <7000@boring.mcvax.UUCP>, jack@mcvax.uucp (Jack Jansen) writes: > > In article <155@daisy.warwick.UUCP> cudcv@daisy.warwick.ac.uk (Rob McMahon) writes: > >In article <523@ccird1.UUCP> rb@ccird1.UUCP (Rex Ballard) writes: > >> > >>if (5<a<50) do_something(a); > >> > >... > >> > >>Is this impossible to parse? > > > >This was in BCPL, and was a GOOD IDEA. > > Yes, it is nice from a users standpoint, but if you want to define > the semantics of this operator in a reasonable way, it becomes > difficult. The only way out I see is to let expressions have *two* > values: an ordinary one, and a success/failure indication. Then you > can let the value of 'a<b' be 'b', and the operator return 'success' > when a is less than b. I remember seeing something about a language that > had such semantics, can't remember which one, however. Icon does just such a thing. Expressions have both a success/fail value and their "normal" value. -- ...smeagol\ Steve Schlaifer ......wlbr->!jplgodo!steve Advance Projects Group, Jet Propulsion Labs ....logico/ 4800 Oak Grove Drive, M/S 156/204 Pasadena, California, 91109 +1 818 354 3171