(j3.2006) LinkedIn Question re Why TYPEALIAS Not in Fortran 2003

Bill Long longb
Mon Jan 27 15:10:56 EST 2014


On Jan 27, 2014, at 1:50 PM, Van Snyder <Van.Snyder at jpl.nasa.gov> wrote:

> On Mon, 2014-01-27 at 13:00 +0000, Bill Long wrote:
>> On Jan 25, 2014, at 8:01 PM, Van Snyder <van.snyder at jpl.nasa.gov>
>> wrote:
>> 
>>> On Sat, 2014-01-25 at 18:48 -0600, Craig Dedo wrote:
> 
>>>>           I have forgotten why TYPEALIAS was dropped late in the
>>>> process.  Does anyone remember why this happened?
>>> 
>>> 1.  It was the wrong thing to do.  New types (not synonymns) are more
>>> useful, and can do everything that type aliases can do -- but not vice
>>> versa.
>> 
>> Certainly not true.  You cannot make a new intrinsic type, which leads
>> to clumsy hacks when trying to map typedefs in C. 
> 
> This isn't a problem if you do it right.  You model new types on type
> extension, with the same sort of compatibility rules.
> 

I must be missing some trick in how to accomplish the simplest ?poster child? application of typealias.  I want 

type(MPI_Comm) :: x

to be equivalent to  

INTEGER(C_INT) :: x

or, if you prefer

type(INTEGER(C_INT)) :: x

to mimic the C header file that contains

typedef int MPI_Comm;

How, exactly, do I do this using type extension?

Cheers,
Bill



> 
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3

Bill Long                                                                       longb at cray.com
Fortran Technical Suport  &                                  voice:  651-605-9024
Bioinformatics Software Development                     fax:  651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101





More information about the J3 mailing list