comp.lang.ada
 help / color / mirror / Atom feed
From: "J-P. Rosen" <rosen@adalog.fr>
Subject: Re: Ada.Strings.Fixed.Count raises Storage_Error
Date: Wed, 29 Jun 2016 20:19:41 +0200
Date: 2016-06-29T20:19:41+02:00	[thread overview]
Message-ID: <nl13fv$rnc$1@dont-email.me> (raw)
In-Reply-To: <dtifmjFl15cU1@mid.individual.net>

Le 29/06/2016 à 19:43, Niklas Holsti a écrit :
> Thanks for this information, Jean-Paul. According to your post in
> http://computer-programming-forum.com/44-ada/cdf3e22c34c4de36.htm, this
> "pathology" was present in Ada 83, but was cured in Ada 95: "It was
> related to a function returning a local  task object, which is no more
> allowed."
> 
> This suggests to me that the definition of Ada 83 was either ambiguous
> in this case, or required too much effort from the implementation for
> this feature compared to the benefits of the feature, and consequently
> the language was changed to eliminate the feature.
No, an unexpected consequence of other rules. The logical place to
return the space occupied by tasks (including the TCB) is when you leave
its master; however, a function (that returned a task type) could return
a local task as the return value; therefore, the identity of the task
could propagate outside of its master, implying some information had to
be kept, and no place to free it.

When I reported the problem to Ichbiah, he told me that this was a
problem for me, but that he was sure it would be no problem for his
compiler. I think he thought that this case could not be tested. But I
did write the test for it...

> Thus, Rosen's pathology was not tolerated, which seems to be what Robert
> Eachus is suggesting, but eliminated.
It was eliminated as a side effect of not allowing the return of a local
limited object.

> The analogous elimination in this case (String with 'Last =
> Integer'Last) would be to change the language to define the index
> subtype of String to run from 1 to Integer'Last - 1. The alternative, to
> correct the library routine to work even in this case, seems better to me.
> 
I don't think there is an analogy with this case. A string indexed up to
Integer'Last is a limit case, not a pathology. And with careful
programming, the cost of handling correctly limit cases is often minimal
(often overestimated until you measure it).

-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr


  reply	other threads:[~2016-06-29 18:19 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-12 11:36 Ada.Strings.Fixed.Count raises Storage_Error Xavier Petit
2016-05-12 15:22 ` Tero Koskinen
2016-05-12 22:05 ` Georg Bauhaus
2016-06-26 21:18   ` Victor Porton
2016-06-26 23:23     ` rieachus
2016-06-27  0:21       ` Jeffrey R. Carter
2016-06-27  4:00         ` rieachus
2016-06-27  0:51       ` Xavier Petit
2016-06-27  4:48         ` rieachus
2016-06-28 18:25           ` Xavier Petit
2016-06-29 18:49           ` Niklas Holsti
2016-06-29 19:40             ` Jeffrey R. Carter
2016-06-29 19:57             ` Dmitry A. Kazakov
2016-07-01 11:48               ` rieachus
2016-07-01 13:08                 ` Dmitry A. Kazakov
2016-06-27  8:29       ` Simon Wright
2016-06-27  8:41         ` Georg Bauhaus
2016-06-29  8:15       ` Niklas Holsti
2016-06-29  9:13         ` J-P. Rosen
2016-06-29 17:43           ` Niklas Holsti
2016-06-29 18:19             ` J-P. Rosen [this message]
2016-06-29 20:30             ` Robert A Duff
2016-06-30  5:38               ` Niklas Holsti
2016-07-01 10:40                 ` rieachus
2016-07-01 10:55                   ` J-P. Rosen
2016-07-01 12:17                     ` rieachus
2016-07-01 12:55                       ` G.B.
2016-06-27 12:52     ` Victor Porton
2016-05-12 22:56 ` Randy Brukardt
replies disabled

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