Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site utcsri.UUCP Path: utzoo!utcsri!greg From: greg@utcsri.UUCP (Gregory Smith) Newsgroups: net.lang Subject: Re: Multiple assignments Message-ID: <2788@utcsri.UUCP> Date: Sun, 18-May-86 13:23:42 EDT Article-I.D.: utcsri.2788 Posted: Sun May 18 13:23:42 1986 Date-Received: Sun, 18-May-86 14:28:34 EDT References: <1455@mmintl.UUCP> <825@bentley.UUCP> Reply-To: greg@utcsri.UUCP (Gregory Smith) Organization: CSRI, University of Toronto Lines: 49 Summary: In article <825@bentley.UUCP> kwh@bentley.UUCP (KW Heuer) writes: >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.... > >>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 think he means: procedure proc( var a : integer ); begin a:= 0; end; begin proc( cc $ dd ); { set cc and dd to 0 } I cannot agree with this - this is glorifying side-effects to a bizarre extent. The implementation is not straightforward, either. Besides, what if 'proc' looks at 'a' before using it? >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.) Right. It's sometimes not better, either, if 'x' is easier to 'get' than 'b': ------- mung.c ----- main(){ int a,b; a=0 ; b=0; a=b=0; } ------ some of mung.a68 ---- clrl a6@(-4) ; a=0 (2 words ) clrl a6@(-8) ; b=0 clrl a6@(-8) ; b=0 movl a6@(-8),a6@(-4) ; a=b ( 3 words) Of course, one can always say that the compiler should have fixed that :-). -- "We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel ---------------------------------------------------------------------- Greg Smith University of Toronto UUCP: ..utzoo!utcsri!greg