comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@comcast.net>
Subject: Re: Improving Ada's image - Was: 7E7 Flight Controls Electronics
Date: Sat, 26 Jun 2004 01:11:20 -0400
Date: 2004-06-26T01:11:20-04:00	[thread overview]
Message-ID: <o_6dnbOJbMLkmEDdRVn-jA@comcast.com> (raw)
In-Reply-To: <sJqdnQIHC9hqOknd4p2dnA@comcast.com>

Robert I. Eachus wrote:

> I do think it is a shame though that Ada returns the upper case version 
> of the name, not the spelling used to declare the type...

This comment of mine seems to have touched a nerve.  So let's see if we 
can save the good parts of the discussion and turn them into something 
useful.

As I see it there are three approaches to solving the problem:  Explicit 
user code, compiler implemented langage extensions, and changes to the 
language.  I think we should agree that it is too late to chage the 
language this time around--although if there is an approach that is 
universally accepted, it could happen.  But first let's look at the 
candidates and see which fly and which get shot down.

I'll discuss user code first, then tomorrow sum up the other alternatives.

This is almost a "why didn't I think of that?" category. It is certainly 
no big deal to write:

function Image(S: Suit) return String is
begin return Suit'Image(S); end Image;

Then later when it is time to make the output look pretty change the 
body to:

function Image(S: Suit) return String is
begin
   case S is
       when Spades => return "Spades";
       when Hearts => return "Hearts";
       when Clubs => return "Clubs";
       when Diamonds => return "Diamonds";
   end case;
end Image;

or you can write:

with Ada.Characters.Handling;
   function Mixed (S: in String) return String is
     use Ada.Characters.Handling;
     Capitalize: Boolean := True;
     Result: String := S;
   begin
     for I in Result'Range loop
       if Capitalize
       then Result(I) := To_Upper(Result(I));
       else Result(I) := To_Lower(Result(I));
       end if;
       Capitalize := Result(I) = '_';
     end loop;
     return Result;
   end Mixed;

and:

type Direction is (North, NNE, NE, ENE, East, ESE, SE, SSE,
                    South, SSW, SW, WSW, West, WNW, NW, NNW);

function Image(D: Direction) return String is
    Result: String := D'Image;
begin
   if Result'Length < 4
   then return Result;
   else return Mixed(Result);
   end if;
end Image;

or:

type Color is (Red, Orange, Yellow, Blue, Green, Violet,
                White, Gray, Black, Brown, Pink);

function Image (C: Color) return String is
begin return Mixed(C); end Image;

It might be nice to add Mixed above to Ada.Characters.Handling as 
To_Mixed, but that is getting into other options. ;-)

-- 

                                           Robert I. Eachus

"Reason and experience both forbid us to expect that national morality 
can prevail in exclusion of religious principles." -- George Washington




  parent reply	other threads:[~2004-06-26  5:11 UTC|newest]

Thread overview: 216+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-30 11:46 Improving Ada's image - Was: 7E7 Flight Controls Electronics Per Dalgas Jakobsen
2004-05-30 16:13 ` Pascal Obry
2004-05-30 18:03   ` Luke A. Guest
2004-05-30 19:09     ` Per Dalgas Jakobsen
2004-05-31  2:28       ` Richard  Riehle
2004-05-31 15:33         ` Wes Groleau
2004-06-01  2:56           ` Hyman Rosen
2004-06-01 14:51             ` Wes Groleau
2004-06-07 16:29             ` Warren W. Gay VE3WWG
2004-06-07 17:44               ` Hyman Rosen
2004-06-08 16:09                 ` Warren W. Gay VE3WWG
2004-06-08 17:30                   ` Hyman Rosen
2004-06-08 20:38                     ` Warren W. Gay VE3WWG
2004-06-08 22:23                       ` Hyman Rosen
2004-06-09  2:27                         ` Warren W. Gay VE3WWG
2004-06-09  4:41                           ` I R T
2004-06-09  6:43                             ` Richard  Riehle
2004-06-10  6:53                               ` Randy Brukardt
2004-06-12  3:16                                 ` Robert I. Eachus
2004-06-09  6:39                           ` Hyman Rosen
2004-06-09  7:44                             ` I R T
2004-06-09 12:13                               ` Georg Bauhaus
2004-06-09 12:34                             ` Warren W. Gay VE3WWG
2004-06-09 21:13                               ` Hyman Rosen
2004-06-10  2:51                                 ` Wes Groleau
2004-06-10 15:57                                   ` Hyman Rosen
2004-06-10 17:18                                     ` Pascal Obry
2004-06-10 12:13                             ` Marin David Condic
2004-06-11 12:48                               ` Warren W. Gay VE3WWG
2004-06-11 17:31                                 ` Marin David Condic
2004-06-14  2:30                                   ` Berend de Boer
2004-06-14  2:47                                     ` I R T
2004-06-14  3:10                                     ` Hyman Rosen
2004-06-14 11:49                                       ` Marin David Condic
2004-06-14 16:28                                         ` Warren W. Gay VE3WWG
2004-06-14 17:34                                           ` Hyman Rosen
2004-06-15 11:35                                             ` Marin David Condic
2004-06-15 23:02                                               ` Brian May
2004-06-16 11:37                                                 ` Marin David Condic
2004-06-21 14:56                                               ` Jacob Sparre Andersen
2004-06-23 20:19                                                 ` Randy Brukardt
2004-06-15 16:30                                             ` Warren W. Gay VE3WWG
2004-06-15 11:26                                           ` Marin David Condic
2004-06-15 16:43                                             ` Warren W. Gay VE3WWG
2004-06-15 18:51                                               ` Hyman Rosen
2004-06-15 21:02                                                 ` Warren W. Gay VE3WWG
2004-06-15 22:01                                                   ` Hyman Rosen
2004-06-15 22:08                                                     ` Ed Falis
2004-06-15 22:26                                                       ` Hyman Rosen
2004-06-17 15:50                                                         ` Robert I. Eachus
2004-06-17 16:12                                                           ` Hyman Rosen
2004-06-17 21:05                                                             ` Pascal Obry
2004-06-17 21:47                                                               ` Hyman Rosen
2004-06-17 22:18                                                                 ` Georg Bauhaus
2004-06-18  5:19                                                                   ` Brian May
2004-06-18 14:44                                                                     ` Georg Bauhaus
2004-06-17 23:02                                                               ` Brian May
2004-06-18  7:50                                                                 ` Martin Dowie
2004-06-19 20:40                                                                   ` Robert I. Eachus
2004-06-19 18:10                                                               ` Ragged arrays of strings (Was: Improving Ada's image) Jacob Sparre Andersen
2004-06-20 22:01                                                                 ` Pascal Obry
2004-06-19 20:54                                                             ` Improving Ada's image - Was: 7E7 Flight Controls Electronics Robert I. Eachus
2004-06-20  2:20                                                               ` Jeffrey Carter
2004-06-20  4:24                                                               ` tmoran
2004-06-20 15:06                                                               ` Dr. Adrian Wrigley
2004-06-21 15:30                                                                 ` Enum'Image (Was: Improving Ada's image) Jacob Sparre Andersen
2004-06-21 16:06                                                                   ` Dr. Adrian Wrigley
2004-06-21 16:53                                                                     ` Alexander E. Kopilovich
2004-06-22 21:38                                                                       ` Jacob Sparre Andersen
2004-06-23 15:42                                                                         ` Alexander E. Kopilovich
2004-06-23 17:15                                                                           ` Larry Kilgallen
2004-06-22 13:26                                                                   ` Dmitry A. Kazakov
2004-06-23 16:04                                                                   ` Frank J. Lhota
2004-06-25  0:07                                                                     ` Enum'Image Jacob Sparre Andersen
2004-06-25 15:55                                                                       ` Enum'Image Frank J. Lhota
2004-06-23 20:29                                                                   ` Enum'Image (Was: Improving Ada's image) Randy Brukardt
2004-06-23 23:35                                                                     ` Dr. Adrian Wrigley
2004-06-25  0:15                                                                       ` Jacob Sparre Andersen
2004-06-26  5:11                                                               ` Robert I. Eachus [this message]
2004-06-27  1:00                                                                 ` Improving Ada's image - Was: 7E7 Flight Controls Electronics Jeffrey Carter
2004-06-27  2:33                                                                 ` Robert I. Eachus
2004-06-15 23:30                                                     ` Dale Stanbrough
2004-06-15 21:59                                               ` Marin David Condic
2004-06-25  4:21                                               ` Enum'Image (Was: Improving Ada's image) Larry Kilgallen
2004-06-15 19:28                                             ` Improving Ada's image - Was: 7E7 Flight Controls Electronics Alexander E. Kopilovich
2004-06-15 21:04                                               ` Warren W. Gay VE3WWG
2004-06-15 22:13                                                 ` Marin David Condic
2004-06-16  0:05                                                 ` Alexander E. Kopilovich
2004-06-15 22:08                                               ` Marin David Condic
2004-06-15 23:06                                                 ` tmoran
2004-06-16 11:47                                                   ` Marin David Condic
2004-06-17  1:33                                                     ` Brian May
2004-06-17 12:09                                                       ` Marin David Condic
2004-06-16  0:56                                                 ` Alexander E. Kopilovich
2004-06-16 11:54                                                   ` Marin David Condic
2004-06-15  1:21                                       ` Alexander E. Kopilovich
2004-07-01  4:08                                         ` Dave Thompson
2004-07-04 19:00                                           ` Robert I. Eachus
2004-06-14 11:45                                     ` Marin David Condic
2004-06-14 13:20                                     ` Larry Kilgallen
2004-06-15 11:39                                       ` Marin David Condic
2004-06-19 23:14                                         ` Pylinius
2004-06-15 11:41                                     ` David Starner
2004-06-15 16:29                                       ` Richard  Riehle
2004-06-15 17:06                                       ` Warren W. Gay VE3WWG
2004-06-11 17:53                                 ` Hyman Rosen
2004-06-11 18:56                                   ` Marin David Condic
2004-06-11 23:23                                     ` Hyman Rosen
2004-06-12  3:08                                     ` Ada BIND was: " Robert I. Eachus
2004-06-12 12:03                                       ` Marin David Condic
2004-06-12 12:47                                         ` Jeff C,
2004-06-13 12:22                                           ` Marin David Condic
2004-06-14 16:33                                             ` Warren W. Gay VE3WWG
2004-06-13  6:08                                         ` Russ
2004-06-13 10:28                                           ` Georg Bauhaus
2004-06-13 14:49                                             ` Stephen Leake
2004-06-13 20:51                                             ` Russ
2004-06-13 23:15                                           ` Robert I. Eachus
2004-06-14  2:09                                             ` Hyman Rosen
2004-06-15  0:02                                               ` Alexander E. Kopilovich
2004-06-15  2:40                                                 ` Brian May
2004-06-15 12:46                                                   ` Frank J. Lhota
2004-06-15 18:53                                                   ` Jeffrey Carter
2004-06-15 22:09                                                     ` Hyman Rosen
2004-07-01  4:08                                                   ` Dave Thompson
2004-06-14 16:43                                           ` Warren W. Gay VE3WWG
2004-06-15 11:47                                             ` Marin David Condic
2004-06-15 16:21                                               ` Warren W. Gay VE3WWG
2004-06-15 19:36                                               ` Frank J. Lhota
2004-06-15 19:51                                                 ` Björn Persson
2004-06-16 13:44                                                   ` Frank J. Lhota
2004-06-15 22:13                                                 ` Hyman Rosen
2004-06-15 22:32                                                   ` Björn Persson
2004-06-15 23:04                                                     ` Hyman Rosen
2004-06-15 23:23                                                       ` Brian May
2004-06-15 23:26                                                       ` tmoran
2004-06-16 18:11                                                         ` Ludovic Brenta
2004-06-15 23:33                                                       ` Björn Persson
2004-06-15 23:18                                                     ` Dale Stanbrough
2004-06-15 23:22                                                       ` Hyman Rosen
2004-06-15 23:37                                                         ` Dale Stanbrough
2004-06-15 23:59                                                       ` Björn Persson
2004-06-16 13:38                                         ` Ada BIND was: Improving Ada's image - Was: 7E7 Flight Controls Larry Kilgallen
2004-06-09 10:52                           ` Ada operating systems Peter C. Chapin
2004-06-09 12:07                         ` Improving Ada's image - Was: 7E7 Flight Controls Electronics Georg Bauhaus
2004-06-11  7:05                           ` Hyman Rosen
2004-06-11 15:07                             ` Georg Bauhaus
2004-06-09 12:32                         ` Marin David Condic
2004-06-15 20:34                         ` Larry Kilgallen
2004-06-08 19:51                   ` Wes Groleau
2004-06-08 22:26                     ` Hyman Rosen
2004-06-09  4:39                   ` I R T
2004-06-09  8:13                     ` Dmitry A. Kazakov
2004-06-09 12:42                       ` Warren W. Gay VE3WWG
2004-06-09 12:38                     ` Warren W. Gay VE3WWG
2004-06-09 16:23                     ` Robert I. Eachus
2004-06-09 16:38                       ` Marius Amado Alves
2004-06-09 20:51                         ` Robert I. Eachus
2004-06-10 12:43                         ` Marin David Condic
2004-06-15 19:55                   ` Larry Kilgallen
2004-06-09 23:45                 ` Richard  Riehle
2004-06-10 12:58                   ` Marin David Condic
2004-06-11 18:03                   ` Russ
2004-06-14 16:16                     ` Warren W. Gay VE3WWG
2004-06-01  2:45         ` Hyman Rosen
2004-06-04 17:24       ` Improving Ada's image - Was: 7E7 Flight Controls Electronics (why not Universities?) Warren W. Gay VE3WWG
2004-06-04 18:46         ` Marius Amado Alves
2004-06-07 12:58           ` Warren W. Gay VE3WWG
2004-06-07 17:11             ` Ada in colleges and universities Peter C. Chapin
2004-06-07 17:29               ` Marius Amado Alves
2004-06-07 19:47                 ` Peter C. Chapin
2004-06-07 18:39               ` Björn Persson
2004-06-07 18:55                 ` Marius Amado Alves
2004-06-07 19:21                   ` Jerome Hugues
2004-06-07 19:27                   ` (see below)
2004-06-07 19:44                     ` Marius Amado Alves
2004-06-08  1:14                     ` Alexander E. Kopilovich
2004-06-07 22:06                   ` Björn Persson
2004-06-07 22:17                     ` (see below)
2004-06-08  9:30                   ` Adrian Knoth
2004-06-08 17:12                     ` Jeffrey Carter
2004-06-08 18:19                       ` Adrian Knoth
2004-06-08  9:53                   ` Jano
2004-06-09  8:55                   ` Pascal Obry
2004-06-07 19:53                 ` Peter C. Chapin
2004-06-07 21:54                   ` Björn Persson
2004-06-09  3:52                     ` I R T
2004-06-09 12:51                       ` Björn Persson
2004-06-10  2:58                         ` Wes Groleau
2004-06-07 22:03                   ` Ludovic Brenta
2004-06-08  0:16                     ` Jeffrey Carter
2004-06-08  5:12                       ` Ludovic Brenta
2004-06-08 16:14               ` Warren W. Gay VE3WWG
2004-06-06 13:34         ` Improving Ada's image - Was: 7E7 Flight Controls Electronics (why not Universities?) Ralph W. Reid
2004-06-07  2:38           ` Robert I. Eachus
2004-05-30 18:47 ` Improving Ada's image - Was: 7E7 Flight Controls Electronics Richard  Riehle
2004-05-31 12:57   ` Marin David Condic
2004-05-31 23:36     ` Berend de Boer
2004-06-01  0:41       ` tmoran
2004-06-01 11:04       ` Marin David Condic
2004-06-01 14:44       ` Wes Groleau
2004-06-01 18:43       ` Pascal Obry
2004-06-07 16:35   ` Warren W. Gay VE3WWG
2004-05-31 12:45 ` Marin David Condic
2004-05-31 20:55 ` Improving Ada's image Björn Persson
2004-06-01  0:41   ` Alexander E. Kopilovich
2004-06-01 11:23   ` Marin David Condic
2004-06-01  2:40 ` Improving Ada's image - Was: 7E7 Flight Controls Electronics Hyman Rosen
2004-06-01 21:14   ` Per Dalgas Jakobsen
2004-06-02  1:12     ` Ed Falis
2004-06-02 10:59     ` Stefan Nobis
2004-06-03  4:19       ` Jeffrey Carter
  -- strict thread matches above, loose matches on Subject: below --
2004-05-31  9:22 Rod Chapman
2004-06-01 11:30 ` Georg Bauhaus
2004-06-18 14:43 abrandon
2004-06-18 17:49 ` Wes Groleau
replies disabled

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