comp.lang.ada
 help / color / mirror / Atom feed
From: Brian Rogoff <bpr@shell5.ba.best.com>
Subject: Re: type names (was Re: Child package: private type and IO)
Date: 1998/03/03
Date: 1998-03-03T00:00:00+00:00	[thread overview]
Message-ID: <Pine.BSF.3.96.980303102557.142A-100000@shell5.ba.best.com> (raw)
In-Reply-To: 6dhghp$suv$1@mulga.cs.mu.OZ.AU


Amazing how much this naming style issue comes up here :-).

On 4 Mar 1998, Fergus Henderson wrote:
>  >The package is misnamed.  A common idiom, and a very OLD idiom in the Ada
>  >community, is to use the plural of the type name as the package name,
> 
> Well, that doesn't help much -- now the usage is
> 
>     Employees : Linked_Lists.Linked_List;
> 
> which is still just as ugly.

FWIW, using the plural package name style I would probably chose either 

	Employees : Linked_Lists.List_Type;

or 

	Employees : Linked_Lists.List_T;

which may still be just as ugly (at least to Matthew) but makes clear 
which part of the name is the type name, even in the presence of a 
use clause. I've yet to determine whether I feel an _Class suffix is 
also appropriate for access to classwide type; I know I don't like the 
"_Access" for Stream_Access.

> It's not a question of "correct" or "incorrect", it's a question
> of style.

I couldn't agree more.

> The style chosen for the standard library strongly
> encourages the use of `use', to avoid unnecessary redundancy in
> names like `Ada.Strings.Unbounded.Unbounded_String'.
> This is probably not such a bad thing
> for the standard library, since experienced Ada programmers 
> will know the standard library well; but for more general settings,
> encouraging the use of `use' may not be such a good idea.

Why not? ;-)

OK, I shouldn't be provoking the anti-use faction here, but since you 
can use use in a restricted scope, I don't see why draconian policies on 
its use are acceptable (SPARK and similar technologies excepted). 

> Personally, I quite like the style of naming types `T',
> e.g. `Ada.Strings.Unbounded.T'.

What about when there is more than one type per package? I suppose in 
many cases (by analogy with inheritance hierarchies) there is really a
main type, so you might have

	Collections.Lists.T;
	Collections.Lists.T_Iter;
	...

but I'm interested in reading about other styles that people have found 
pleasant, so please elaborate.

> I think Ada is big enough for more than one idiom!

Indeed. 

-- Brian







  reply	other threads:[~1998-03-03  0:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-14  0:00 Child package: private type and IO johnjohn
1998-02-16  0:00 ` Tom Moran
1998-02-17  0:00 ` sparre
1998-02-27  0:00   ` Matthew Heaney
1998-03-01  0:00     ` type names (was Re: Child package: private type and IO) Ray Blaak
1998-03-01  0:00       ` Matthew Heaney
1998-03-01  0:00         ` Brian Rogoff
1998-03-01  0:00           ` Matthew Heaney
1998-03-03  0:00             ` Ray Blaak
1998-03-04  0:00         ` Fergus Henderson
1998-03-03  0:00           ` Brian Rogoff [this message]
1998-03-04  0:00             ` John G. Volan
1998-03-05  0:00               ` Case sensitivity [was Re: type names (was Re: Child package: private type and IO)] Anonymous
1998-03-05  0:00                 ` John G. Volan
replies disabled

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