Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbatt!cbosgd!ihnp4!inuxc!pur-ee!uiucdcs!uicsrd!mcdaniel From: mcdaniel@uicsrd.CSRD.UIUC.EDU Newsgroups: net.lang.c Subject: Re: Additions to C - range checking Message-ID: <19600001@uicsrd> Date: Sun, 6-Jul-86 21:01:00 EDT Article-I.D.: uicsrd.19600001 Posted: Sun Jul 6 21:01:00 1986 Date-Received: Thu, 10-Jul-86 01:48:51 EDT References: <523@ccird1.UUCP> Lines: 35 Nf-ID: #R:ccird1.UUCP:523:uicsrd:19600001:000:1341 Nf-From: uicsrd.CSRD.UIUC.EDU!mcdaniel Jul 6 20:01:00 1986 /* Written 7:42 pm Jun 30, 1986 by franka@mmintl.UUCP in uicsrd:net.lang.c */ >In article <523@ccird1.UUCP> rb@ccird1.UUCP (Rex Ballard) writes: >>Is this impossible to parse? >To my knowledge (I don't know >everything), only COBOL actually does this. As a comparative language note, ICON does it. "a < b" returns "b" if the comparison succeeds; with left-to-right association of "a < b < c", it works. The tricky part is that I haven't said what happens if the comparison is false. In that case, the expression "fails", and the rest of the statement is skipped; the next statement is executed. (Actually, ICON has PROLOG-like goal-directed evaluation: 2 < find("a", "ababc") will fail; find will be "resumed" where it left off to find any later substrings and the expression will return 3. It would take kilobytes to explain fully.) So this model is not applicable to C, alas. To find the max of two variables in C, we can say if (a < b) a = b; In ICON, the idiom is a <:= b Almost any binary operator can augment assignment, like C's "+=". This is "a := a < b"; if a >= b, the comparison fails and the rest of the statement is skipped. I think ICON is a truly great, clean language (for its domain). > I, for one, think it's a good > idea; but for new languages, please -- don't try and change C to accomodate > it. Yeah.