Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!pasteur!sim.Berkeley.EDU!hshankar From: hshankar@sim.Berkeley.EDU (RAMACHANDRAN HARISHANKAR) Newsgroups: comp.lang.fortran Subject: Re: [long]Re: modules in f8x Message-ID: <1553@pasteur.Berkeley.Edu> Date: 15 Mar 88 05:36:00 GMT References: <9872@steinmetz.steinmetz.UUCP> <1178@ut-emx.UUCP> <1456@pasteur.Berkeley.Edu> <5208@uwmcsd1.UUCP> Sender: news@pasteur.Berkeley.Edu Reply-To: hshankar@sim.Berkeley.EDU.UUCP (RAMACHANDRAN HARISHANKAR) Organization: University of California, Berkeley Lines: 57 Keywords: fortran,f8x,typing In article <5208@uwmcsd1.UUCP> zdenko@csd4.milw.wisc.edu (Zdenko Tomasic) writes: >In article <1456@pasteur.Berkeley.Edu> hshankar@sim.Berkeley.EDU.UUCP (RAMACHANDRAN HARISHANKAR) writes: >>The kind of strong >>typing available in pascal does not handle tensors and units. >> >>A more general example is the need to distinguish covarient and contravarient >>indices in a tensor. Both are indices going from 1 to 4. But never should >>we allow covarient to contract with covarient and vv. I do not know of an >>algorithm that will allow fortran to enforce this, but I do know that pascal >>does not. [I learnt the language for that purpose and found it unsuitable] >> > >The above just proves the need for the user defined data structures >and operations. No compiler (or compiler writer, language designer) >can predict all the needs of the world, just the most common ones. >However one should be careful with customized definitions, else >the eventually data structure extensible languages may end up being >a big mess rather than help. Make a new structure only if you really >need it and it cannot be easily achieved through the common ones. > I would think that it is precisely such cases - data structures that represent common physical objects - where we need specific implementations. I don't care WHO does it; ie whether it is done in a macro or in the compiler, but would want the ability to enforce tensor relationships. As far as I know, the kind of user defined data structures that have been proposed do not make tensors possible. Similarly, the user defined data structures also do not make associating quantities with units possible. . Another example: If I want an array of structures, it is very easy to create, once I have the structure defined. But if I want the STRUCTURE of the array to be a group, then very difficult. ie, if I wanted to refer to the velocity field of a flow on a torus, I define a coordinate system on the torus as (x,y), each coordinate is modulo 2 pi. The velocity field would consist of 2 entries at each (x,y). So EXTREMELY simple structure. What is complex is the way the indices interact. If I store 40 points for the 2 pi range, then I would want the entry at (64,38) to be identified with the entry at (24,38). In practice, for each reference of this data type, I would apply the modulo operator to the arguments. And frequently I do this using a preprocessor. However this is possible only because of the extremely simple nature of the example. I am not aware of any way in which user defined data structures make this possible. And I feel that this is the kind of data structures that is really useful in mathematical physics. The elements of the system are invariably in a tangent space, and so well suited to Fortran's existing data structures. It is the interconnections among the indices that messes things up. To me this kind of data structure definition ought to be as accessible as the kind available for Pascal and C. It makes the transfer of ideas to program that much easier, which in the ultimate analysis is the justification of language features. > >Zdenko Tomasic harishankar ramachandran u.c. berkeley