Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!topaz!bentley!kwh From: kwh@bentley.UUCP (KW Heuer) Newsgroups: net.lang Subject: Re: Multiple assignments Message-ID: <825@bentley.UUCP> Date: Thu, 15-May-86 22:30:54 EDT Article-I.D.: bentley.825 Posted: Thu May 15 22:30:54 1986 Date-Received: Sat, 17-May-86 04:57:19 EDT References: <1455@mmintl.UUCP> Organization: AT&T Bell Laboratories, Liberty Corner Lines: 38 In article <1455@mmintl.UUCP> franka@mmintl.UUCP (Frank Adams) writes: >... Supposing that "$" is being used for this ["multi-assignment"] operator, >then to set both "a" and "b" to zero, one would write "a $ b = 0", rather >than "a = b = 0", as C does.... Some dialects of BASIC use "LET A,B = 0" for this. >On the other hand, if your language supports argument passing by address, >it permits an output argument to be multiply assigned; something which >assignment-with-value does not support. What do you mean by this? I don't see how this operator allows you to do anything that simple assignment doesn't. Examples? I was going to suggest a valueless assignment operator ":=" (a := b = 0), but now I think your idea is a little closer to what I wanted. Instead of "a $ b = 0" , let's write that symmetrically as a := } } 0 b := } or (since R-to-L assignment is a historical wart) { =: a 0 { { =: b Now, to put that into a form that can be parsed, 0 fork { =: a | =: b } The advantage over "$" is that this allows the duplicated value to be used in other contexts, like the C idiom "while ((c = getchar()) != EOF)". The observant observer has noticed that what I have is quite close to the FORTH syntax "0 dup a ! b !" ("!" is the store operator), except that I've been explicit about the parallelism. Btw (somebody is bound to point this out, may as well be me), the result of "a = b = x" in C is not really "b = x; a = x" as implicitly assumed above; it's "b = x; a = b". (It makes a difference if a and b differ in width.) Karl W. Z. Heuer (ihnp4!bentley!kwh), The Walking Lint