comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@comcast.net>
Subject: Re: Mutable parameter of a function (long ago was: Re: What evil would happen?)
Date: Sat, 03 Jan 2004 19:58:15 -0500
Date: 2004-01-03T19:58:15-05:00	[thread overview]
Message-ID: <-MWdnftXl-K1-GqiRVn-hQ@comcast.com> (raw)
In-Reply-To: <bt681k$3klk4$1@ID-77047.news.uni-berlin.de>

Dmitry A. Kazakov wrote:

> No, it is better never use tricks. The Rosen trick is in general an ability
> for an object to identify itself in all context, even in ones stating
> something opposite about it. That is an extremely dangerous thing, which
> breaks substitutability and so the contract. Is this the motivation for
> exposing this potential contract violation to code maintainer using a
> pragma? But that would by no means solve the problem. It would make things
> only worse. It would say, look, this is an in-parameter, but wait, that was
> just joking, because, here is a pragma, carefully hidden somewhere else,
> that states the opposite.

As long as the use does comply with the ADT model it doesn't bother me. 
  This is certainly the case with a random number generator.  The model 
is that calling Random uses the generator but doesn't modify it.  There 
are other operations in the random number package that do change the 
generator state, and do have the correct (in out) interface.  (Yes, I 
know that the call really does change some hidden values in the 
generator, but that is equivalent to having a pointer in the generator, 
and changing values in the target of the pointer.

But if I did have the pragma available, I'd put it in the private part...

> IMO it would be difficult to make it in a consistent way without reviewing
> the ADT model in Ada. But the time will come, I hope.

Sort of my point.  It would be nice to "improve" Ada with constant 
subtypes.  But there are a lot more useful things to do first, then see 
if they fit.

-- 
                                           Robert I. Eachus

"The war on terror is a different kind of war, waged capture by capture, 
cell by cell, and victory by victory. Our security is assured by our 
perseverance and by our sure belief in the success of liberty." -- 
George W. Bush




  reply	other threads:[~2004-01-04  0:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-02 17:55 Mutable parameter of a function (long ago was: Re: What evil would happen?) Alexandre E. Kopilovitch
2004-01-03  1:56 ` Robert I. Eachus
2004-01-03 11:18   ` Dmitry A. Kazakov
2004-01-04  0:58     ` Robert I. Eachus [this message]
2004-01-04 12:07       ` Dmitry A. Kazakov
2004-01-05  3:17         ` Alexandre E. Kopilovitch
2004-01-05  9:55           ` Dmitry A. Kazakov
2004-01-05 16:19             ` Robert I. Eachus
2004-01-06  3:04             ` Randy Brukardt
2004-01-06  9:32               ` Dmitry A. Kazakov
2004-01-06  3:01         ` Randy Brukardt
2004-01-06  9:26           ` Dmitry A. Kazakov
replies disabled

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