[J3] Syntax for enumeration

Ondřej Čertík ondrej at certik.us
Tue Oct 15 18:43:35 EDT 2019



On Tue, Oct 15, 2019, at 3:30 PM, Bill Long via J3 wrote:
> 
> > On Oct 15, 2019, at 2:50 PM, Ondřej Čertík via J3 <j3 at mailman.j3-fortran.org> wrote:
> > 
> >> 
> >> 1)
> >> 
> >>    TYPE,ENUM :: my_enum
> >>        a,b
> >>        c
> >>    END TYPE
> 
> 
> 
> I would prefer this form.  Simple and to the point.  Emphasizes that a 
> TYPE is involved.  And it omits the ENUMERATOR keyword - typing this is 
> tedious.  The lack of declarations for the enums signals that these are 
> not components. 

I like omitting the ENUMERATOR keyword also. The argument against this is that every other statement in Fortran begins with a keyword. So there should be a keyword here also, unless we want to not make these a statement, which changes the syntax radically, something like:

TYPE, ENUM :: my_enum = {a, b, c}

But this syntax might have other issues, if we want to later extend it.

Ondrej


More information about the J3 mailing list