[J3] [EXTERNAL] Syntax for enumeration
Clune, Thomas L. (GSFC-6101)
thomas.l.clune at nasa.gov
Wed Oct 16 10:51:21 EDT 2019
One amusing thought that I had at breakfast this morning, that I’m sure Malcolm will hate:
TYPE, ENUM :: MY_ENUM
… red, green, blue
… purple
END TYPE
This may even be particularly apropos if/when extension of ENUMS comes back.
I mention this only on the off chance that I’ve misanticipated Malcolm’s response (which is often the case).
- Tom
On Oct 16, 2019, at 7:44 AM, Thomas.L.Clune at nasa.gov<mailto:Thomas.L.Clune at nasa.gov> wrote:
In addition to Malcolm’s comments, I really object to arguments about the “number of characters to type”. Even a very primitive editor supports cut-and-paste, and slightly better ones may autocomplete “ENU” for you.
More relevant is the impact on the _reader_ of the code. Code is (usually) read many more times than it is written. In this case “ENUMERATOR” has (almost) no information content and disproportionately fills the line for some coding styles. OTOH, if one generally lines things up, then the eyes should be able gloss over the left hand column of ENUMERATORS to see the values.
And if one is really desperate, there is FPP:
#define ENU ENUMERATOR ::
I’m not opposed to a shorter keyword, but given the existing practice _and_ the description in the requirements and specs, there is really not likely to be an acceptable alternative.
- Tom
On Oct 15, 2019, at 4:51 PM, Malcolm Cohen via J3 <j3 at mailman.j3-fortran.org<mailto:j3 at mailman.j3-fortran.org>> wrote:
Guys, we already *have* an ENUMERATOR statement.
This suggested syntax is IMNSHO completely unacceptable. Having a statement that is a simple list of names is crap. And has no place to put anything useful like an accessibility attribute.
The keyword ENUMERATOR signals extremely strongly that these are not components!
In the common case one would write ENUMERATOR precisely once. This is not a burden, let alone a great burden.
Cheers,
--
..............Malcolm Cohen, NAG Oxford/Tokyo.
From: J3 <j3-bounces at mailman.j3-fortran.org<mailto:j3-bounces at mailman.j3-fortran.org>> On Behalf Of Bill Long via J3
Sent: Wednesday, October 16, 2019 7:30 AM
To: General J3 interest list <j3 at mailman.j3-fortran.org<mailto:j3 at mailman.j3-fortran.org>>
Cc: Bill Long <longb at cray.com<mailto:longb at cray.com>>
Subject: Re: [J3] Syntax for enumeration
> On Oct 15, 2019, at 2:50 PM, Ondřej Čertík via J3 <j3 at mailman.j3-fortran.org<mailto: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.
Cheers,
Bill
Bill Long longb at cray.com<mailto: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
Disclaimer
The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. Please see our Privacy Notice<https://urldefense.proofpoint.com/v2/url?u=https-3A__www.nag.co.uk_content_privacy-2Dnotice&d=DwMFaQ&c=ApwzowJNAKKw3xye91w7BE1XMRKi2LN9kiMk5Csz9Zk&r=EDCdNzkccJ25Co3sjWrr1HlJQ3_CoIFWfekFE1ulcLI&m=3lqSzyRPw_1NPtD7UaK2-1MyymBN9uWoAqDT12lSDDk&s=VM1kwD5RUwQ60eKrzfa9PnNq08rP_yr-m7T_CSYh4YQ&e=> for information on how we process personal data and for details of how to stop or limit communications from us.
This e-mail has been scanned for all viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20191016/59540b4e/attachment-0001.html>
More information about the J3
mailing list