comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov>
Subject: Re: Naming conventions
Date: 25 Jul 2002 11:20:58 -0400
Date: 2002-07-25T15:29:44+00:00	[thread overview]
Message-ID: <u8z3zzvdx.fsf@gsfc.nasa.gov> (raw)
In-Reply-To: 3D3F58F4.9050305@hotmail.com

Ryan Tarpine <rtarpine@hotmail.com> writes:

> Coming from C++, what I used to think of as a class (a type and its
> associated methods) is now roughly equivalent to a package.  Whenever I
> try to name a package, I use what I normally think of as the type
> itself.  For example, I would put a vector type in a package Vector or a
> regular expression type in a package Regular_Expression.  However, once
> I name the package, I am at a loss for what to call the data type inside.

Welcome to the club :).

> I've been appending '_Type' to the package names, making names like
> Vector_Type, but I don't think that is the Right Thing(TM). 

I would name the type using _Type:

package Vector is

    type Vector_Type is ... ;
end Vector;

That's a nice, simple convention. You don't have to think about it.

However, if you don't use 'use', it looks a little redundant. In that
case, just name the type 'T':

package Vector is
   type T is ...;
end Vector;

with Vector;
package Client is

    Velocity : Vector.T;

end Client;

Have fun!


-- 
-- Stephe



  parent reply	other threads:[~2002-07-25 15:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-25  1:48 Naming conventions Ryan Tarpine
2002-07-25  2:51 ` Ted Dennison
2002-07-25  3:11 ` tmoran
2002-07-25  4:28 ` SteveD
2002-07-25 11:50 ` David C. Hoos, Sr.
2002-07-25 15:20 ` Stephen Leake [this message]
2002-07-25 16:24   ` Jean-Pierre Rosen
  -- strict thread matches above, loose matches on Subject: below --
1987-11-13 23:10 Michael.Rissman
replies disabled

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