Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!axiom!drilex!rclex!cdx39!jc From: jc@cdx39.UUCP (John Chambers) Newsgroups: net.lang Subject: Re: Re: Multiple assignments Message-ID: <201@cdx39.UUCP> Date: Fri, 23-May-86 10:30:47 EDT Article-I.D.: cdx39.201 Posted: Fri May 23 10:30:47 1986 Date-Received: Mon, 26-May-86 00:05:10 EDT References: <1455@mmintl.UUCP> <825@bentley.UUCP> <1482@mmintl.UUCP> Lines: 42 [Let's try again and see if readnews can acces the news files this time around.] > > > then to set both "a" and "b" to zero, one would write "a $ b = 0", > > > rather than "a = b = 0", as C does.... I've always sorta wondered why programming languages never seem to use the same sort of comma-based syntax that most human languages use, e.g.: (a, b, c) = 0; /* C , PL/I*/ (a, b, c) := 0; /* Pascal */ SET a, b, c = 0 /* Basic */ A, B, C = 0.0 /* Fortran */ I mean, we're all familiar with this sort of usage from many years of using it. In C, it almost made it into the language, since there is a comma operator. You just can't use it in an "lvalue" expression. Surely there is no problem making a compiler understand such syntax. As for why you might want it in C, haven't you ever been bitten by the "feature" of incompatible types in a set-several-things-to-zero command? Try the following: main() { char *x; double y; y = x = 0; } and see what your C compiler does. Silly, isn't it? (Despite the Cobol fiasco, there are ideas from natural languages that could be carried over to programming languages. :-) -- John M Chambers (617-364-2000x7304) / cthulhu \ /usenet / inmet \ / news ...!{ harvax }!cdx39!{ jc \ mit-eddie / \ uucp \ mot[bos] / \root