comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov>
Subject: Re: on package naming, should the word "_pkg" be part of it?
Date: 08 Oct 2001 15:06:54 -0400
Date: 2001-10-08T19:08:40+00:00	[thread overview]
Message-ID: <uitdqkl2p.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: 3BC1DB22.E127B53D@boeing.com

Jeffrey Carter <jeffrey.carter@boeing.com> writes:

> Stephen Leake wrote:
> > 
> > I use _Type. The reason is that types and objects share the same
> > namespace, yet the most reasonable name for an object and a type is
> > the same:
> > 
> > type Car is record ... end record;
> > 
> > Car : Car;
> > 
> > This is natural, but illegal. The easiest (for _me_, not for
> > everyone!) way to resolve it is to add some "noise" to either the
> > object or the type. Since the object name will appear more often than
> > the type, I add noise to the type:
> 
> No, it's not natural. 

Well, it is for me, in the situations I have encounterd so far.
Celebrate diversity :).

> What might be natural is
> 
> VIN_ABC1234567JKLK67 : Car;

That's solving a different problem than I had in mind; you are
assuming you need one named Ada object per physical car. My example is
way too short for you to jump to this conclusion. See my other post
for a better example (primitive operations of a type).

> Car : Chevy_1957;

Still another problem; each model of car should have a different type.

> More realistically,
> 
> Current_Vehicle : Car;

Still another problem; iterating thru a collection.

> Even this is incorrect. Current_Vehicle is not a car, it is a
> collection of information about a car:
> 
> Current_Vehicle : Car_Info;

Actually, I would have assumed it was a collection of information
about a vehicle, which might not be a 'car':

Vehicle_Info : Vehicle_Info_Type;

:).

> The developer thinks, "This type is a collection of information
> about cars, so its name should be
> Collection_Of_Information_About_Cars, or Car_Info for short." Or
> something like that.

Car_Info : Car_Info_Type;

> Further, there is generally no problem with object names, since
> objects of the type are generally not declared in the same scope:
> 
> Car : Car_Handler.Car;

Well, sometimes this is true, but not _always_. In particular,
primitive operations of tagged types _must_ be declared in the same
scope as the type. And I don't want a separate convention for that!

> It is parameter names defined in the same scope that are perceived
> as a problem. In many cases, even parameter names are not a problem.
> When inserting into a list, Into seems a better parameter name than
> List; when iterating over a structure, Over seems better than List,
> Queue, or Stack, and so on.

Not to me. Sometimes you can make the function call read more
"naturally" with parameter names like "Into". But the body reads very
oddly, unless you use renames on the parameters, which is error-prone.

> Maybe _Info is still noise, but it seems like more reasoned noise
> than _Type. If the object is simply to put some noise on the end of
> type names to distinguish them from parameter names, then _T seems
> as good as any other noise.

Yes, _T is a good choice. I'm not entirely sure why I originally chose
_Type instead of _T. At this point, there are many in the Ada comunity
that use _Type; I don't know of any that use _T. So _Type wins.

> Another "solution" I have seen is
> 
> <snip non-tagged example>
> 
> Never a name problem!

Unless you need tagged types and primitive operations.

As I said in another post, you can come up with alternate solutions to
any particular instance of _Type. But _Type is the simplest one that works
_everywhere_. It's nice to have one naming convention, rather than several.

Another strong argument here is that you can get used to any style,
after a while. The exact details of the style matter far less than
having a consistent style in the first place.

For this particular style question, Ada imposes a constraint; objects
and types share a namespace. Any solution to this constraint is
acceptable. I like _Type because it is mindless (I have plenty of
other things to think about), and works _everywhere_. But if I was on
a project that had a different convention, I would adapt (although,
sometimes resistance is _not_ useless :).

-- 
-- Stephe



  reply	other threads:[~2001-10-08 19:06 UTC|newest]

Thread overview: 130+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-04 19:58 on package naming, should the word "_pkg" be part of it? mike
2001-10-04 20:34 ` Larry Hazel
2001-10-04 20:54   ` Pascal Obry
2001-10-04 21:04   ` on package naming, should the word Ted Dennison
2001-10-04 22:00     ` Preben Randhol
2001-10-04 22:13       ` Brian Rogoff
2001-10-04 23:38         ` Larry Kilgallen
2001-10-04 23:43           ` Preben Randhol
2001-10-05  0:40             ` MM
2001-10-05  3:22               ` Brian Rogoff
2001-10-04 22:09     ` tmoran
2001-10-05 14:21       ` Ted Dennison
2001-10-04 20:53 ` on package naming, should the word "_pkg" be part of it? Marin David Condic
2001-10-05  9:24   ` John McCabe
2001-10-05 10:35     ` mike
2001-10-05 13:29       ` Stephen Leake
2001-10-05 14:17         ` mike
2001-10-05 14:39       ` on package naming, should the word Ted Dennison
2001-10-05 15:07         ` mike
2001-10-05 15:56           ` Ted Dennison
2001-10-05 16:12             ` Francisco Javier Loma Daza
2001-10-06  9:16               ` Simon Wright
2001-10-06 12:36               ` Marc A. Criley
2001-10-05 16:52       ` on package naming, should the word "_pkg" be part of it? Jeffrey Carter
2001-10-05 12:54     ` Marin David Condic
2001-10-05 17:11     ` Jeffrey Carter
2001-10-05 18:52       ` Wes Groleau
2001-10-05 19:17       ` Vincent Marciante
2001-10-08  8:26         ` John McCabe
2001-10-05  1:55 ` Jeffrey Carter
2001-10-06  9:25   ` Simon Wright
2001-10-07 19:49     ` Jeffrey Carter
2001-10-07 21:12       ` Brian Rogoff
2001-10-08 14:51       ` Stephen Leake
2001-10-08 16:11         ` Francisco Javier Loma Daza
2001-10-08 16:17           ` John McCabe
2001-10-09  7:41             ` Francisco Javier Loma Daza
2001-10-10  8:04               ` John McCabe
2001-10-10  9:47                 ` John McCabe
2001-10-10 10:17                   ` Francisco Javier Loma Daza
2001-10-10 10:27                   ` Francisco Javier Loma Daza
2001-10-10 12:50                     ` John McCabe
2001-10-10 13:41                       ` Francisco Javier Loma Daza
2001-10-08 16:25         ` Robert*
2001-10-08 19:50           ` Matthew Woodcraft
2001-10-08 16:37         ` on package naming, should the word Ted Dennison
2001-10-08 16:41         ` on package naming, should the word "_pkg" be part of it? Vincent Marciante
2001-10-08 18:50           ` Stephen Leake
2001-10-08 19:46             ` Vincent Marciante
2001-10-08 16:58         ` Jeffrey Carter
2001-10-08 19:06           ` Stephen Leake [this message]
2001-10-08 19:43             ` Brian Rogoff
2001-10-09 14:22               ` on package naming, should the word Ted Dennison
2001-10-10  5:24                 ` Richard Riehle
2001-10-09 23:02               ` on package naming, should the word "_pkg" be part of it? Darren New
2001-10-10  0:55                 ` Brian Rogoff
2001-10-10  1:48                   ` Robert*
2001-10-10  2:28                     ` Brian Rogoff
2001-10-10 15:10                       ` Darren New
2001-10-10 18:38                         ` tmoran
2001-10-10 19:30                           ` Darren New
2001-10-10  9:51                     ` Larry Kilgallen
2001-10-10 13:05                     ` John McCabe
2001-10-10 15:37                       ` Pascal Obry
2001-10-10 17:05                         ` Steven Deller
2001-10-10 17:54                           ` Pascal Obry
2001-10-11  8:35                         ` John McCabe
2001-10-10 15:53                       ` M. A. Alves
2001-10-10 18:53                         ` Robert*
2001-10-11  6:54                           ` Preben Randhol
2001-10-11 12:07                             ` Robert*
2001-10-11 12:40                               ` Lutz Donnerhacke
2001-10-11 14:24                                 ` Marin David Condic
2001-10-11 15:17                                   ` Larry Kilgallen
2001-10-11 15:34                                   ` Robert*
2001-10-11 17:41                                     ` David Starner
2001-10-12  8:25                                       ` John McCabe
2001-10-12  9:07                                         ` Ian Wild
2001-10-12 10:16                                           ` John McCabe
2001-10-12 12:04                                             ` Ian Wild
2001-10-12 17:01                                         ` Jeffrey Carter
2001-10-15  8:18                                           ` John McCabe
2001-10-15 18:21                                             ` Jeffrey Carter
2001-10-15 19:00                                               ` Pascal Obry
2001-10-15 20:26                                             ` on package naming, should the word Ted Dennison
2001-10-15 20:52                                               ` Robert*
2001-10-15 21:57                                                 ` Ted Dennison
2001-10-15 22:40                                                 ` Jeffrey Carter
2001-10-16  8:40                                                 ` Jean-Pierre Rosen
2001-10-16 12:49                                               ` John McCabe
2001-10-16 16:57                                                 ` Jeffrey Carter
2001-10-17  8:23                                                   ` John McCabe
2001-10-11 18:37                                     ` on package naming, should the word "_pkg" be part of it? M. A. Alves
2001-10-11 19:39                                       ` on package naming, should the word Ted Dennison
2001-10-12 11:23                                         ` M. A. Alves
2001-10-13 17:32                                           ` Richard Riehle
2001-10-11 21:03                                       ` on package naming, should the word "_pkg" be part of it? Preben Randhol
2001-10-12  8:35                                         ` John McCabe
2001-10-12 11:35                                           ` M. A. Alves
2001-10-11 21:01                                     ` Preben Randhol
2001-10-12  2:04                                       ` David Starner
2001-10-12  9:02                                         ` Preben Randhol
2001-10-12 19:15                                           ` David Starner
2001-10-13 11:26                                             ` Preben Randhol
2001-10-12  2:29                                       ` Brian Rogoff
2001-10-12  8:45                                         ` Preben Randhol
2001-10-12 10:20                                           ` John McCabe
2001-10-12 14:54                                           ` on package naming, should the word Ted Dennison
2001-10-12 19:21                                           ` on package naming, should the word "_pkg" be part of it? David Starner
2001-10-12 21:23                                             ` Vector..
2001-10-13  2:13                                               ` Brian Rogoff
2001-10-13  3:21                                             ` Mark Biggar
2001-10-15 16:18                                       ` John McCabe
2001-10-11 13:19                               ` Preben Randhol
2001-10-11 13:42                               ` on package naming, should the word Ted Dennison
2001-10-11 15:18                                 ` Robert*
2001-10-11 15:47                                   ` Ted Dennison
2001-10-11 16:15                                   ` Larry Kilgallen
2001-10-11 16:15                                   ` Marin David Condic
2001-10-11 20:16                                   ` Simon Wright
2001-10-12  8:33                                     ` John McCabe
2001-10-12 16:27                                       ` Darren New
2001-10-14 20:34                                   ` Jacob Sparre Andersen
2001-10-14 22:03                                     ` Robert*
2001-10-15 12:04                                       ` Lutz Donnerhacke
2001-10-15 21:17                                         ` Florian Weimer
2001-10-15  6:50                               ` on package naming, should the word "_pkg" be part of it? Mats Karlssohn
2001-10-15 10:24                                 ` Larry Kilgallen
2001-10-18 16:23           ` Robert A Duff
2001-10-05  6:05 ` MM
replies disabled

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