Please note I serve as an alternate, non-voting member to INCITS J3 and I have been requesting and advocating for a proper enumeration type facility in Fortran 202X since 2018, right around when the work began on Fortran 202X.
My own vision and the use cases for Fortran based on industry experiences as to how a related set of named constants are preferably consumed in scientific and engineering codes are summarized in this paper.
In the above paper usually referred to as 19-229
, you will find the use cases and requirements pretty much touch upon the needs and requirements the two of the you have listed upthread. For example, @zedthree what you show with name collision with the colours
module was precisely what I wanted Fortranners to not encounter in their codes and thus I added a requirement:
My simple goal is to minimize “magic values” from appearing in Fortran code because that leads to costly mistakes and to employ mnemonics as much as possible when it comes to working with constant values that belong to a group or a set.
The above paper was submitted to J3 committee and it is drafted entirely from the user perspective, especially in industry. I failed miserably and was unable to influence the design even a bit.
So my proposal was clearly seen by the voting members of the committee as entirely B.S. but I also then failed to see anything better being proposed that could be much of any use in actual coding practice with Fortran 202X. What eventually got voted in left me aghast, that is:
- I am of the opinion the
enumeration type
feature in Fortran 202X is mostly flawed. - It is a tremendous disservice to the actual users of Fortran to have two deeply flawed and highly confusing features,
enum
type in addition toenumeration type
, that convey rather similar use cases and yet have very different semantics and syntax, - I have long been thinking whether it will be better for Fortran to get “something”, however poorly designed, into the language starting 202X that will take 10+ years after publication for compiler support only to consider improvements and extensions in 202Y and 203X that may or not happen but if they do, they will take additional 10+ years before users can consider using it in their codes. Or, whether it will be better to do-it-right-this-time. I’m inclined toward the latter.
- Given the previous point, I have been contemplating whether to start a petition with the users that reach WG5 to withdraw the
enumeration type
feature from Fortran 202X considering how useless it is at this point. - Outside of a strong external influence on WG5 e.g, via one or more national bodies, say BCS in UK, or similar in Germany or Japan, etc., it shall indeed remain the case "the current design is set in stone."
So there you have it, one take on the situation.