comp.lang.ada
 help / color / mirror / Atom feed
From: Brian Rogoff <bpr@shell5.ba.best.com>
Subject: Re: Distinguishing type names from other identifiers
Date: 1998/01/29
Date: 1998-01-29T00:00:00+00:00	[thread overview]
Message-ID: <Pine.BSF.3.96.980129134215.19999A-100000@shell5.ba.best.com> (raw)
In-Reply-To: mheaney-ya023680002801981901590001@news.ni.net


On Wed, 28 Jan 1998, Matthew Heaney wrote:
> In article <Pine.BSF.3.96.980128085901.28109A-100000@shell5.ba.best.com>,
> Brian Rogoff <bpr@shell5.ba.best.com> wrote:
>
> >> ... quoting Matthew Heaney here ... 
> >> Another example is importing an active iterator as a generic formal type:
> >> 
> >> generic
> >>    Max_Depth : in Positive;
> >> package Stacks.Bounded is
> >> 
> >>    type Bounded_Stack is new Root_Stack with private;
> >> ...
> >>    generic
> >>       type Source_Stack is new Root_Stack with private;
> >> 
> >>       type Source_Stack_Iterator (Stack : access Source_Stack'Class) is 
> >>          new Root_Stack_Iterator with private;
> >> 
> >>    procedure Generic_Copy
> >>       (From : access Source_Stack'Class;
> >>         To      : in out Bounded_Stack);
> >> 
> >> end Stacks.Bounded;
> >
> >This is also OK, but I still don't see why you find the redundant _Type 
> >to be "noise" and the redundant _Stack, not-noisy. I find qualifiers like 
> >_Stack worse, since qualified package names already have that information. 
> >What's your thinking on this? 
> 
> I always use adjective+noun.  A tagged type hierarchy always has this
> convention: each derivation has a different adjective, but the noun is the
> same.  I never use package qualification to get the "real" name, because
> the real name is always the name of the type.  A package is just a
> namespace - it is not a type.

Right, I mistyped, and meant why Stack_Iterator rather than just Iterator
or Iterator_Type ;-), since its obvious from the package scope that its a 
Stack_Iterator, and if you had Iterators over different collections you
could use the qualified names. I certainly never confuse packages and
types, and find Ada's separation of the two one of its most positive
features. I'm not a big Eiffel fan, my favorite "other language" is ML.

> The Root_<type> convention comes out the RM, and I have adopted it for
> consistency with that document.  The adjective+noun style also comes out of
> the RM: it's what is used for types Bounded_String and Unbounded_String.

Yes, I acknowledge that this is a reasonable basis for a style, though I 
prefer the _Type suffixes, and I combine the two all the time

> You get the idea.  Some guys name their abstract data type "Object" or
> "Instance," but this is a horrible convention because it confuses the
> concepts of type and module.

Agreed. I may use _Class if the type is classwide, to distinguish between 
a classwide and non-classwide type, but I haven't yet. 

>  Some Ada programmers actually think that a
> class in C++ or Eiffel maps to an Ada package!

I've seen this in an Ada 95 book. Once again, I agree that it is horrible.

> A class in C++ is the equivalent of an Ada tagged type.  Yes, I know that
> in other languages a class does double-duty as a module and type, but in
> Ada they are orthogonal language features.

Even in C++, the namespace feature was eventually added, and many language
designers now acknowledge that module and type should be separate
features.

I think in some ways the addition of OO features to Ada was simply
brilliant, and some decisions that are criticized, like the function
syntax instead of the dot syntax, will be well received in the future. 
It leaves the door open for the addition of (possibly restricted) multiple 
dispatch in the future. 

-- Brian







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

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-01-07  0:00 Two simple language questions Chip Richards
1998-01-07  0:00 ` Tucker Taft
1998-01-07  0:00 ` Matthew Heaney
1998-01-10  0:00   ` Two simple language questions (plural types) Michael F Brenner
1998-01-10  0:00     ` Robert Dewar
1998-01-10  0:00       ` Matthew Heaney
1998-01-10  0:00         ` Robert Dewar
1998-01-12  0:00         ` Anonymous
1998-01-12  0:00           ` Brian Rogoff
1998-01-12  0:00           ` Matthew Heaney
1998-01-12  0:00             ` Brian Rogoff
1998-01-13  0:00               ` Robert Dewar
1998-01-13  0:00                 ` Distinguishing type names from other identifiers Nick Roberts
1998-01-13  0:00                   ` Matthew Heaney
1998-01-14  0:00                     ` Stephen Leake
1998-01-24  0:00                       ` Matthew Heaney
1998-01-15  0:00                     ` Anonymous
1998-01-24  0:00                       ` Matthew Heaney
1998-01-24  0:00                         ` Martin M Dowie
1998-01-24  0:00                         ` Martin M Dowie
1998-01-24  0:00                           ` Pred Nick Roberts
1998-01-25  0:00                           ` Distinguishing type names from other identifiers Matthew Heaney
1998-01-15  0:00                   ` Aaro Koskinen
1998-01-17  0:00                     ` Martin M Dowie
1998-01-17  0:00                       ` Martin M Dowie
1998-01-25  0:00                       ` Matthew Heaney
1998-01-25  0:00                         ` Brian Rogoff
     [not found]                         ` <n5rs5FAStOz0Ew2+@dowie-cs.demon.co.uk>
1998-01-26  0:00                           ` Brian Rogoff
1998-01-27  0:00                             ` Martin M Dowie
1998-01-27  0:00                               ` Brian Rogoff
1998-01-27  0:00                                 ` Matthew Heaney
1998-01-28  0:00                                   ` Brian Rogoff
1998-01-28  0:00                                     ` Matthew Heaney
1998-01-29  0:00                                       ` Brian Rogoff [this message]
1998-01-30  0:00                                     ` Mats Weber
1998-01-28  0:00                                 ` Martin M Dowie
1998-01-11  0:00     ` Two simple language questions (plural types) Brian Rogoff
1998-01-07  0:00 ` Two simple language questions Robert Dewar
1998-01-07  0:00 ` Dale Stanbrough
  -- strict thread matches above, loose matches on Subject: below --
1998-01-13  0:00 Distinguishing type names from other identifiers Adam Beneschan
1998-01-14  0:00 ` Brian Rogoff
1998-01-15  0:00   ` Michael F Brenner
1998-01-15  0:00     ` Nick Roberts
1998-01-16  0:00       ` Robert Dewar
1998-01-16  0:00         ` Michael F Brenner
1998-01-16  0:00           ` Robert Dewar
1998-01-16  0:00             ` Brian Rogoff
1998-01-17  0:00               ` nabbasi
1998-01-18  0:00                 ` Robert Dewar
1998-01-16  0:00             ` Robert Dewar
1998-01-21  0:00           ` Philip Brashear
1998-01-20  0:00         ` Benoit Jauvin-Girard
1998-01-20  0:00           ` Robert Dewar
1998-01-14  0:00 tmoran
1998-01-14  0:00 ` Robert Dewar
1998-01-14  0:00   ` Brian Rogoff
1998-01-14  0:00     ` nabbasi
1998-01-15  0:00       ` Brian Rogoff
1998-01-25  0:00 tmoran
1998-01-25  0:00 ` Brian Rogoff
1998-01-26  0:00   ` Nick Roberts
replies disabled

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