X3J3/96-082 Date: April 29, 1996 To: X3J3 From: Kurt W. Hirchert Subject: JOR Item No. 116 116 "Simultaneous" assignment <KEYWORDS> <STATUS> Registered <TARGET> <SUBGROUP> <VERSION> 1 <REQUIREMENT> Provide some mechanism for more general "simultaneous" assignment, i.e. evaluating all "right hand sides" before modifying the "left hand sides". <JUSTIFICATION> It is a common problem to have a set of variables that must be updated based on their collective current state. Introducing explict temporary variables to achieve this obscures the logic and may produce less efficient code than what a compiler can do with architecture-specific temporary generation. <SUGGESTED IMPLEMENTATION> I can think of several very different notation approaches. One would be to allow derived type "pseudo-variables" on the left hand side of an assignment (making use of the simultaneity within a derived type assignment): SWAP(X,Y)=SWAP(Y,X) Another would be to try to extend the simultaneity of the FORALL statement: FORALL(I=1:2) SELECT CASE(I) CASE(1); N=M CASE(2); M=N+M END SELECT END FORALL Yet another would be to create a new construct for this: SIMUL X=X*COS_THETA-Y*SIN_THETA Y=X*SIN_THETA+Y*COS_THETA END SIMUL <ESTIMATED IMPACT> The impact on the document is likely to be localized. Impact on existing processors appears potentially significant. <SUBMITTED BY> Kurt W. Hirchert, hirchert@ncsa.uiuc.edu <HISTORY> <EVENT> 29 April 96: submitted </HISTORY> </FORTREQ> -- Kurt W. Hirchert hirchert@ncsa.uiuc.edu National Center for Supercomputing Applications