J3/04-217 Date: 2004-01-14 To: J3 From: Walt Brainerd Subject: Alternate addressing of structure components Date: 2004-01-08 at 08:14:09 Request number: Pub-110 Name: Jack Saba E_mail: jack.saba@gsfc.nasa.gov ========================================================== Number: Title: Alternate addressing of structure components Submitted by: J3 Status: For Consideration References: Basic Functionality: Ability to access components of structures using location of component in the structure (or some other method compatible with accessing via loop). Rationale: There are instances (many, in my case) where one wants to do the same thing to all components of a structure. In Fortran 95, it is necessary to rewrite essentially the same code (even if it is only a call to a subroutine) separately for each component. With this feature, it would be possible to access all components using a do loop. For example, if the syntax chosen was to use the component location in the structure enclosed in parentheses, one could write DO i=1,N CALL DoSomethingWithComponents ( Struct % (i) ) END DO rather than having a list of (sometimes many) calls, one for each component. Estimated Impact: I don't know how easy this would be to implement. The Interactive Data Language (IDL) has such a feature. Its presence there has made a marked difference on code complexity and hence the time it takes to write, debug, and maintain the code. I have written some code in IDL rather than Fortran specifically because of this feature. Detailed Specification: Probably not in the appropriate format, since I'm not sure what that is, but... Structure components shall be accessible by using their locations within the structure. The syntax for this shall be the location enclosed within parentheses, in place of the component name. Example: Struct % SecondComponent and Struct % (2) will both access the same compoent of the structure Struct. History: Submitted as Pub-110