comp.lang.ada
 help / color / mirror / Atom feed
From: dewarr@my-dejanews.com
Subject: Re: Pb with use of redefined "=" operator
Date: 1998/11/06
Date: 1998-11-06T00:00:00+00:00	[thread overview]
Message-ID: <71tee6$pi5$1@nnrp1.dejanews.com> (raw)
In-Reply-To: m3lnlq4fqd.fsf@mheaney.ni.net

In article <m3lnlq4fqd.fsf@mheaney.ni.net>,
  Matthew Heaney <matthew_heaney@acm.org> wrote:
> dewarr@my-dejanews.com writes:
>
> > In article <m3iugv70ke.fsf@mheaney.ni.net>,
> >   Matthew Heaney <matthew_heaney@acm.org> wrote:
> >
> > > It is for this reason that I always implement (the full view of) ADTs as
> > > tagged, even if the partial view is not itself tagged.
> >
> >
> > I think that this is definitely a wrong approach. The fact of the matter is
> > that when you get to complex record types, it is rather rare to use the
> > equality operator meaning just component equality. It seems quite
unnecessary
> > to introduce the overhead resulting from gratuitous tagging just in case
this
> > (mis)use occurs.
>
> So you don't like this implementation of a stack?
>
>    type Stack_Type is private;
>
> private
> ...
>    type Stack_Type is
>       tagged record
>          Items : Item_Array;
>          Top   : Natural := 0;
>       end record;
>
> The tagging here hardly seems gratuitous, as it's necessary to correct
> what is arguably a flaw in the language!

Right, I think that is a poor implementation of stacks, since it results in
unnecessary inefficiencies, and the utility of being able to compare stacks is
marginal in typical use.

There is of course the currently fashionable code-bloat style of programming
where no one cares if their programs run slowly and take up too much memory,
but the trouble is that if you write standard packages in this style, it very
much restricts the uses they can be put to (in many embedded and safety
critical applications, tagged types are eliminated for good reasons!)

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




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

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-11-03  0:00 Pb with use of redefined "=" operator Fran�oise & Herv� BITTEUR
1998-11-04  0:00 ` Mats Weber
1998-11-04  0:00   ` Fran�oise & Herv� BITTEUR
1998-11-04  0:00 ` dewarr
1998-11-04  0:00   ` Tucker Taft
1998-11-04  0:00 ` Matthew Heaney
1998-11-04  0:00   ` Mats Weber
1998-11-05  0:00     ` Matthew Heaney
1998-11-05  0:00       ` Mats Weber
1998-11-05  0:00         ` Matthew Heaney
1998-11-09  0:00           ` Robert A Duff
1998-11-09  0:00             ` Brian Rogoff
1998-11-10  0:00               ` Robert A Duff
1998-11-10  0:00             ` Robert I. Eachus
1998-11-05  0:00       ` dewarr
1998-11-05  0:00         ` Matthew Heaney
1998-11-06  0:00           ` dewarr [this message]
1998-11-09  0:00             ` Robert A Duff
1998-11-10  0:00               ` dennison
1998-11-10  0:00                 ` Robert A Duff
replies disabled

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