[J3] Syntax for enumeration
Bill Long
longb at cray.com
Tue Oct 15 18:49:35 EDT 2019
> On Oct 15, 2019, at 3:43 PM, Ondřej Čertík via J3 <j3 at mailman.j3-fortran.org> wrote:
>
>
>
> 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}
I would avoid { } here - we should save these for the future. But
TYPE,ENUM :: nu_enum = ( <enum-name-list> )
would seem OK.
Cheers,
Bill
>
> But this syntax might have other issues, if we want to later extend it.
>
> Ondrej
Bill Long longb at cray.com
Principal Engineer, Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9143
Cray, a Hewlett Packard Enterprise company/ 2131 Lindau Lane/ Suite 1000/ Bloomington, MN 55425
More information about the J3
mailing list