Right, that is precisely a proper version of the second kind I mentioned.
The "new type" requirement being associated with the *first kind*.
That is, "first kind" ~= "like the Ada facility", you get a new type;
"second kind" ~= "like the C facility", you get an alias for an intrinsic
integer type+kind.
Both kinds have some advantages, but many (most?) use cases can use either.
A few use cases require a specific one: some the "first kind" (new type),
some the "second kind" (integer type).
It is a version the second kind that we have, unfortunately with clunky
non-intuitive syntax, the "proper" version being deleted as we both agree.
Personally I am mildly in favour of somehow improving the situation, but it
is far from obvious to me what the best solution is. We could straighten out
the syntax we have for the "second kind". That could be done in a
relatively easy way if we just stopped there, as the second kind literally
is just a wrapper for an integer. Or we could actually go back and do
typealias properly (some people might agree with you that "type alias" is a
bad idea, but a very large number of people would strongly disagree). That
would certainly be a bigger job, with a bigger impact on the type system and
on implementations. Or we could add a "new type" version of enum, with an
even bigger impact on the type system and on implementations. Or a "new
type" version of typealias, with perhaps the greatest impact of all! Each
of those choices satisfies a different set of users, and which set is larger
is very hard to judge, let alone which would have the best cost-benefit
ratio.
There also seems to be other versions of enum in other languages which
differ from both of the above, so we're not even limited to the too-long
list I just enumerated...
Cheers,
-----Original Message-----
From: Van Snyder
Sent: Friday, April 1, 2016 2:11 AM
To: [log in to unmask]
Subject: Re: [COMP-FORTRAN-90] What are the possible hurdles to enhanced
"enum" functionality in Fortran?
On Wed, 2016-03-30 at 16:33 +0900, Cohen Malcolm wrote:
> We had a “proper” version of the second kind in the Fortran 2003
> draft, except that the description was unfortunately broken beyond
> repair in the time available before publication, so it was removed.
The version in 02-007 wasn't a "proper" version of the second kind. It
allowed a declaration of a type alias name for integer type, which isn't
a new type. It was "type alias" that was broken beyond repair (and a
bad idea in the first place), and anything that depended upon it was
rightfully removed.
--
........................Malcolm Cohen, Nihon NAG, Tokyo.
|