comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Re: Limited_Controlled and out parameters
Date: Sat, 23 Jun 2012 05:02:09 -0700 (PDT)
Date: 2012-06-23T05:02:09-07:00	[thread overview]
Message-ID: <2f16226a-65fd-48d0-88d0-57259e80acf7@googlegroups.com> (raw)
In-Reply-To: <js2k76$b9r$1@munin.nbi.dk>

W dniu piątek, 22 czerwca 2012 22:22:57 UTC+2 użytkownik Randy Brukardt napisał:

[...]
> Since his example includes a component with an access type, it is always 
> included in this bullet, so the behavior of the parameter is the same for 
> "in out" and "out". And thus it is safe and reasonable to check if the 
> object is already in use.

Thank you very much for a thorough explanation, this now makes sense.
Still, the solution does not feel very comfortable - the language seems to be somewhat spoiled by such nuances. Is it OK to read "out" parameters? Well, it depends on things that are defined far away from the place in question.

> (And I agree, don't make these things limited unless you really must not 
> allow assignment. It's not that hard to write a proper Adjust routine for a 
> type like this one. "Limited poisoning" is a real problem in practice.)

I don't fully agree here - I would rather approach it the other way round: start from the most limited (pun intended) set of operations and add to them only when necessary. Automatic call to Finalize is not necessarily what I want to have in such places - the type in question might be much more complex than what I have presented and the problematic procedure need not rewrite the whole object. But then I would use "in out" mode to reflect the fact that the post-call state depends on pre-call value.

-- 
Maciej Sobczak * http://www.msobczak.com * http://www.inspirel.com



      reply	other threads:[~2012-06-23 12:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-22 13:37 Limited_Controlled and out parameters Maciej Sobczak
2012-06-22 15:43 ` Adam Beneschan
2012-06-22 16:58   ` J-P. Rosen
2012-06-22 19:12     ` Adam Beneschan
2012-06-22 21:41       ` Robert A Duff
2012-06-22 20:22   ` Randy Brukardt
2012-06-23 12:02     ` Maciej Sobczak [this message]
replies disabled

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