comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <matthew_heaney@acm.org>
Subject: Re: Pb with use of redefined "=" operator
Date: 1998/11/05
Date: 1998-11-05T00:00:00+00:00	[thread overview]
Message-ID: <m3btmm4eq0.fsf@mheaney.ni.net> (raw)
In-Reply-To: 3641D551.CCA4379C@elca-matrix.ch

Mats Weber <Mats.Weber@elca-matrix.ch> writes:

> Matthew Heaney wrote:
> 
> > I make it a point that when I create a composite type --an abstract data
> > type, or "open," as in your example-- that I guarantee equality will
> > compose.
> > 
> > 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.
> 
> But if you do that, then you don't need to explicitly import "=" as a
> generic formal, because the reemergence problem does not exist with
> (visibly or not) tagged types.

But not everyone is enlightened as I am :), and they may "forget" to
implement their abstraction as tagged, if they've also overridden
predefined equality.

My philosophy is, I'll make the generic work, so you the client don't
have to think about it.  Bullet-proof abstractions.


> This also makes the following trick unnecessary:
>
> > But the solution is trivial: just don't use equality for the composite
> > type!  What I do is, always declare the equality for composite types as
> > abstract:

This is not a trick: it's a feature of the language!  And besides, this
"trick" is only done inside the generic that imports equality for the
formal type.

Why would anyone complain about using a component that always works?

We are not philosophers debating morality -- we are systems builders.
Our goal is to build correct systems, by whatever means necessary.

If using a language feature to make an abstraction work is "gratuitous,"
or seems like a "trick," then that is a telling observation of the
language itself!





  reply	other threads:[~1998-11-05  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 [this message]
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
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