Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!unmvax!brainerd From: brainerd@unmvax.unm.edu (Walt Brainerd) Newsgroups: comp.lang.fortran Subject: Re: dpANS Fortran 8x Message-ID: <193@unmvax.unm.edu> Date: 30 Jun 89 23:04:10 GMT References: <2724@elxsi.UUCP> <6105@microsoft.UUCP> Distribution: usa Organization: University of New Mexico at Albuquerque Lines: 59 In article <6105@microsoft.UUCP>, bobal@microsoft.UUCP (Bob Allison) writes: > In article <2724@elxsi.UUCP> uunet!elxsi!corbett (Bob Corbett) writes: > > > > One feature of Fortran 8x I find particularly annoying is that the type > >definition facility permits only record types to be defined. The lack of a > >general type definition mechanism becomes even more irritating now that KIND > >selectors have been added to the language. Suppose a machine supports 64-bit > >integers. The Fortran 8x implementation for such a machine might permit > >64-bit integer entities to be declared with a syntax such as > > > > INTEGER(64) :: entity-decl-list > > > >The number 64 is the kind selector. Suppose a programmer is trying to write > >a program for several different machines, and he or she has lots of data > >object declarations for objects he or she wishes to be of the largest supported > >integer type. If the language supported a general type definition facility, he > >or she could place a definition of a type, say LONGEST_INT, in an INCLUDE file, > >and then use that type wherever it is needed. The closest the current draft of > >the standard will allow him or her to come to that solution is to allow a > >definition of a structure containing a single field of the longest integer type > > [...] > > It turns out this is easily solvable: the kind parameter may be a parameter > (that is, a symbolic constant): > > INTEGER, PARAMETER :: MOST_INT_BITS = 64 > INTEGER(MOST_INT_BITS) :: entity-decl-list > The request was for a user-defined type that does not involve structures. What do parameters have to do with anything? > However, it doesn't allow you to define a type, merely a type kind. My > personal resistance to that feature (contrary to Walt Brainerd's assertion > that we're all morons who can't handle the concept) is that it doesn't mesh ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > well with the current rules of FORTRAN syntax: if we could define the first > token in each statement of an explicitle separated declaration section to > be a reserved keyword or a type (as in other languages which support this > feature), then I wouldn't have any problem. However, FORTRAN has enough > areas already where the context just takes too long to resolve, and I am > reticent to introduce more areas. > The evidence for my alleged implication is mounting! (or maybe it's just me) but I don't understand what the first token of a statement has to do with anything, either. What I think is being requested is the ability to do something like this (all statements begin with a keyword): TYPE LONGEST_INT INTEGER(64) ! with or without a paramter END TYPE LONGEST_INT and then be able to declare TYPE (LONGEST_INT) :: entity-decl-list Walt Brainerd Unicomp, Inc. brainerd@unmvax.cs.unm.edu -- Walt Brainerd Unicomp, Inc. brainerd@unmvax.cs.unm.edu