[J3] [EXTERNAL] Re: 21-120r2: Discussion on the feasibility of any future enhancement of Enumeration Type

Reuben D. Budiardja reubendb at ornl.gov
Tue Mar 2 21:40:57 UTC 2021


On 03/02/2021 01:11 PM, Ondřej Čertík via J3 wrote:
> Hi,
> 
> The paper https://j3-fortran.org/doc/year/21/21-110r1.txt is extending the enum type, here is an example syntax (from the paper):
> 
> Module enum_mod
>    Enum,Bind(C) :: myenum
>      Enumerator :: one=1, two, three
>    End Enum
>    Enum,Bind(C) :: flags
>      Enumerator :: f1 = 1, f2 = 2, f3 = 4
>    End Enum
> Contains
>    Subroutine sub(a) Bind(C)
>      Type(myenum),Value :: a
>      Print *,a ! Acts as if it is Print *,Int(a).
>    End Subroutine
> End Module
> 
> 
> Why cannot we simply allow to drop the `bind(c)`, then we have an enumeration type that we can use?

Because this does not satisfy the requirements for "true enumerations 
types". The purpose of this one is to be better interoperable with C enum.


> I do not think we should have two enumeration types in the language.
> 

The way I see it, there will only be one enumeration type in 202X. This 
is 21-120r2. 21.110 is / should be really part of the interoperability 
with C.

Best,
Reuben




More information about the J3 mailing list