comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Redefinition of Equality (Long)
Date: 1996/09/29
Date: 1996-09-29T00:00:00+00:00	[thread overview]
Message-ID: <DyHzHy.5qA@world.std.com> (raw)
In-Reply-To: 52hgmoINN7tg@snoopy.cis.ohio-state.edu


In article <52hgmoINN7tg@snoopy.cis.ohio-state.edu>,
david scott gibson <dgibson@snoopy.cis.ohio-state.edu> wrote:
>In order to compare the elements from two sets, a redefined equality
>function must remove elements from the sets first. ...

It seems highly undesirable for "=" to modify its parameters.  If you
want to implement "=" in terms of some destructive operations, then you
ought to make a copyof the parameters first.  Why is this a problem?

I certainly agree that functions should allow 'in out' parameters, but
not so you can write evil "=" operations.  But even if 'in out' were
allowed, you would still have your problem, because for *tagged* types
an overriding operation has to be subtype conformant with what it's
overriding.

You ask why the rule about 'in out' wasn't changed.  I think it was for
two reasons: (1) Tucker was ambivalent, and was worried about
implementation difficulties (having to do copy-backs for out parameters
in the middle of an expression, rather than only at the end of a
statement, for an existing compiler that wasn't designed to do that).
(2) About half of the reviewers were rabidly anti-side-effect zealots.
Despite the fact that Ada functions allow side effects on globals, and
on stuff pointed to by parameters, this contingent believed that
preventing *some* forms of side effects (namely, on parameters) is
better than nothing.

I was very much in favor of removing this restricion.  And I've found it
frustrating when writing Ada 95 code.  I happen to think that *some*
kinds of side effects are OK, and I find it annoying that I have to use
access parameters, and put "aliased" and "'Access" all over the place.

- Bob




  reply	other threads:[~1996-09-29  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-09-27  0:00 Redefinition of Equality (Long) david scott gibson
1996-09-29  0:00 ` Robert A Duff [this message]
1996-09-29  0:00   ` Robert Dewar
1996-09-30  0:00   ` Dave Gibson
1996-09-30  0:00     ` Robert A Duff
1996-10-02  0:00       ` Robb Nebbe
1996-10-04  0:00       ` Kenneth Almquist
1996-10-04  0:00         ` david scott gibson
1996-10-07  0:00           ` Kenneth Almquist
1996-10-04  0:00       ` Redefinition of Equality david scott gibson
replies disabled

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