comp.lang.ada
 help / color / mirror / Atom feed
* Extensible Enumerated Types
@ 2001-02-11 17:07 Robert C. Leif, Ph.D.
  2001-02-11 20:27 ` John H. Lindsay
  0 siblings, 1 reply; 2+ messages in thread
From: Robert C. Leif, Ph.D. @ 2001-02-11 17:07 UTC (permalink / raw)
  To: Comp. Lang. Ada

From: Bob Leif
To: Robert Dewar et al.
Following your excellent suggestion, I have created, an" Informal comment on
this International Standard". I have also employed FrameMaker to translate
this into XML including creating a cascading style sheet. I would recommend
storing all of these items in XML. I will gladly send the XML document and
cascading style sheet to anyone. However, the FrameMaker export had to be
edited and the equivalent of an Ada renames has to be found or created in
XML for cascading style sheets.

I would like to thank all of my fellow readers of Comp.Lang.Ada who came up
with formats for extensible enumerated types, such as my second example. If
you believe that you have a better suggestion than the 3 that I have listed,
please post it and send it in (I guess) as an Informal comment on this
International Standard".

From: Annotated Ada Reference Manual (AARM)
http://www.ada-auth.org/arm-html/RM-0-3.html
Instructions for Comment Submission

Informal comments on this International Standard may be sent via e-mail to
ada-comment@ada-auth.org. If appropriate, the Project Editor will initiate
the defect correction procedure.

Comments should use the following format:
-------------------------------------------------------------------
Topic: Extensible Enumerated Types
Reference: RM95-3.5.1 (pp. 37)
From: Robert C. Leif, Ph.D.
Date: 01-02-11
Keywords: Extensible, Enumerated, Types, Supertypes
1. Discussion:
	1.1 Introduction:
The addition of child libraries facilitates programing by extension. The
child, which evolves from the parent, can be either a supplement to or
specialization of the parent. In any case the specification of the child
should be limited to types and methods specific to the child.

In the case of enumerated types, this approach is violated. Theoretically,
the author of the software has to know in advance all of the values of the
enumerated type. The child libraries would then specialize this type by
employing subtypes.

Another argument goes back to minimizing coupling and maximizing cohesion.
For instance, the universe of name prefixes could easily exceed 100. For
instance, in the case of Great Britain, all of the titles of nobility have
to be added. The military and public officials would also have to be
included. A simple example for this is a registration form for SIGAda. Since
one of the best rules for data entry, is to minimize user entry of strings,
pull-down menus with a list of choices are a good solution for the entry of
enumerated types. However, the use of a menu with a list of 100 or more
selections is highly user-hostile. Therefore a subtype will have to be used
to populate the menu. Since it is extremely doubtful that a significant
number of clergy or members of the nobility attend SIGAda, the number of
items in the Name.Prefix menu can be reduced by neither including the
prefixes for the clergy nor the nobility. It would be simpler to have the
values for the clergy and nobility in separate child packages that can if
need be withed. The parent package will have to be modified each time a
prefix necessary for the child package has been discovered to have been
omitted. It should be noted, that it is quite easy to omit, one or two items
in an enumerated type. The flexibility of being able to add elements to an
enumerated type will result in a smaller number of items being included in
the original enumeration and simplify the creation of child packages.

2. Possible Approaches:
type Prefix_Type is (None, Mr, Ms, Miss, Mrs, Dr, Prof, Rev, Other);

(1)
supertype Army_Prefix_Type is (Prefix_Type, Private, Corporal, Sergeant,
Lieutenant, Captain, Major, Colonel, General);

(2)
type Army_Prefix_Type is new Prefix_Type with (Private, Corporal, Sergeant,
Lieutenant, Captain, Major, Colonel, General);

(3)
type Army_Prefix_Type is (Prefix_Type�range & ((Private, Corporal, Sergeant,
Lieutenant, Captain, Major, Colonel, General));

Example (1) is expressive; however it requires a new keyword supertype,
which is an antonym of subtype and thus provides symmetry.
Example (2) uses the �is new� construct, which is severely overloaded.
Example (3) uses the �&� operator and is analogous to string handling.
---------------------------------------------------------------------------
Formal requests for interpretations and for reporting defects in this
International Standard may be made in accordance with the ISO/IEC JTC1
Directives and the ISO/IEC JTC1/SC22 policy for interpretations. National
Bodies may submit a Defect Report to ISO/IEC JTC1/SC22 for resolution under
the JTC1 procedures. A response will be provided and, if appropriate, a
Technical Corrigendum will be issued in accordance with the procedures.










^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Extensible Enumerated Types
  2001-02-11 17:07 Extensible Enumerated Types Robert C. Leif, Ph.D.
@ 2001-02-11 20:27 ` John H. Lindsay
  0 siblings, 0 replies; 2+ messages in thread
From: John H. Lindsay @ 2001-02-11 20:27 UTC (permalink / raw)


Dear c.l.a Folks:

"Robert C. Leif, Ph.D." wrote:
.....

> I would like to thank all of my fellow readers of Comp.Lang.Ada who came up
> with formats for extensible enumerated types, .....
.....
> Informal comments on this International Standard may be sent via e-mail to
> ada-comment@ada-auth.org. 
.....

It's great to see something sustantive come out of an open 
discussion forum like this !  

John.

-- 
John H. Lindsay                             eil@kingston.net
48 Fairway Hill Crescent, Kingston, Ontario, Canada, K7M 2B4.
Phone:  (613) 546-6988   Fax:  (613) 542-6987



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-02-11 20:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-11 17:07 Extensible Enumerated Types Robert C. Leif, Ph.D.
2001-02-11 20:27 ` John H. Lindsay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox