From owner-sc22wg5@dkuug.dk  Sat May  3 00:36:56 2003
Received: (from majordom@localhost)
	by dkuug.dk (8.12.8p1/8.9.2) id h42Mau1k085973
	for sc22wg5-domo; Sat, 3 May 2003 00:36:56 +0200 (CEST)
	(envelope-from owner-sc22wg5@dkuug.dk)
X-Authentication-Warning: ptah.dkuug.dk: majordom set sender to owner-sc22wg5@dkuug.dk using -f
Received: from mailhub.dfrc.nasa.gov (mailhub.dfrc.nasa.gov [130.134.81.12])
	by dkuug.dk (8.12.8p1/8.9.2) with ESMTP id h42MZREc085945
	for <sc22wg5@dkuug.dk>; Sat, 3 May 2003 00:36:52 +0200 (CEST)
	(envelope-from maine@altair.dfrc.nasa.gov)
Received: from mail.dfrc.nasa.gov by mailhub.dfrc.nasa.gov with ESMTP for sc22wg5@dkuug.dk; Fri, 2 May 2003 15:34:03 -0700
Received: from altair.dfrc.nasa.gov ([130.134.20.211])
          by mail.dfrc.nasa.gov (Post.Office MTA v3.5.3 release 223
          ID# 0-71686U2500L200S0V35) with ESMTP id gov
          for <sc22wg5@dkuug.dk>; Fri, 2 May 2003 15:36:13 -0700
Received: from altair.dfrc.nasa.gov (localhost.localdomain [127.0.0.1])
	by altair.dfrc.nasa.gov (8.12.8/8.12.5) with ESMTP id h42MaHEc009235
	for <sc22wg5@dkuug.dk>; Fri, 2 May 2003 15:36:17 -0700
Received: (from maine@localhost)
	by altair.dfrc.nasa.gov (8.12.8/8.12.8/Submit) id h42MaHUb009231;
	Fri, 2 May 2003 15:36:17 -0700
From: Richard Maine <Richard.Maine@nasa.gov>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <16050.62177.156544.391246@altair.dfrc.nasa.gov>
Date: Fri, 2 May 2003 15:36:17 -0700
To: sc22wg5@dkuug.dk
Subject: Enum has been emasculated
X-Mailer: VM 7.07 under 21.4 (patch 8) "Honest Recruiter" XEmacs Lucid
Sender: owner-sc22wg5@dkuug.dk
Precedence: bulk


Here's a paper for Dresden.  I thought this one had sufficient
technical content to merit a separate paper instead of throwing
it in with my paper of miscellaneous comments.

-- 
Richard Maine                |  Good judgment comes from experience;
Richard.Maine@nasa.gov       |  experience comes from bad judgment.
                             |        -- Mark Twain
-----------------------------------------
Date:     2 May 03
To:       WG5
From:     Richard Maine
Subject:  Enum has been emasculated

In the process of removing typealias, paper j3/03-119r1 redefined
enum so that it no longer depended on typealias.  Unfortunately,
this redefinition was done with an ax; it just deleted the part
of enum that formerly referred to typealias.  In my opinion, this
so emasculates enum as to make it an embarrassment - it cut out
the most important part of enum.

Enum in the current draft is fundamentally a feature for C
interop; we deleted the non-BIND(C) variant of it.  As an
interop feature, the fundamental point of enum is to determine
the appropriate integer kind that would interoperate with the
corresponding C enums....and that's the part that got cut out.
What remains is just the syntactic sugar of having a different
syntax for defining a set of integer named constants.

Without type aliases, we need to use a kind type parameter.
That would be ok, but the enumeration doesn't give us one.

One can still deduce the kind, but only by using an indirection,
the silliness of which just points out that the current feature
design is flawed.  You have to pick one of the enumerators at
random and do an inquiry on it.  For example, if we want to
declare a variable appropriate for the enumeration given in
Note 4.66 on page 65 (after it is corrected to actually conform
to the bnf), we need to do something like

  integer, parameter :: pc_kind=kind(red)
  integer(pc_kind) :: some_variable

or, if we had no other need for pc_kind, we could shorten it to

  integer(kind(red)) :: some_variable

This is just silly.  What is special about red here?  Nothing,
but we need to choose one of the enumerators at random.

The enumeration should directly define a parameter for this
purpose instead of requiring us deduce it by inquiring about one
of the enumerators.  Syntax TBD.  One obvious possibility is
just to put the kind parameter name in the same place as we
used to have the typealias name.  I suppose that in principle
it could even be optional, though it seems likely to be wanted
almost all the time in practice.

In my opinion, if we should either fix this problem or delete
enum entirely (which we voted not to do at the previous meeting).
As is, it's flaws are so blatant as to be an embarassment.
