From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: ANN: PLplot plotting library with Ada bindings
Date: Fri, 18 Oct 2013 21:27:50 -0500
Date: 2013-10-18T21:27:50-05:00 [thread overview]
Message-ID: <l3sqn7$rkp$1@loke.gir.dk> (raw)
In-Reply-To: 9006bf4b-e682-4803-a5e3-b0363ecb61d1@googlegroups.com
"Jerry" <lanceboyle@qwest.net> wrote in message
news:9006bf4b-e682-4803-a5e3-b0363ecb61d1@googlegroups.com...
On Tuesday, October 1, 2013 5:45:57 PM UTC-7, Jeffrey Carter wrote:
> On 10/01/2013 05:31 PM, Jerry wrote:
...
>> > ...
>> > End_PLplot; -- Call this only once.
>>
>> Why not use finalization to do this?
>
>...
>I don't know what happens if the library doesn't get finalized but it
>probably ties up
>resources so an automatic process would be wise in that sense.
The problem with requiring manual finalization is that it doesn't work when
the program propagates an exception. In that case, the user's explicit call
doesn't get executed. You could try to require them to handle such
exceptions and do the finalization in a handler, but that's both a mess and
something that's easy to forget. And even that doesn't work in the face of
abort (although that's probably not a significant concern in this case).
Thus, I think you always want automatic finalization if any is needed. It
might make sense to also support a manual version (especially in this case,
where you wouldn't want to force an incompatibility on any of your users,
which you would if you completely got rid of the End_PLPlot routine.) -- but
you don't want that manual version to be required. (Of course, this assumes
that the finalization actually does something important; if the OS cleans up
well enough after an program that terminated unexpectedly, then this doesn't
apply.)
Even if *correct* programs would be fine with manual finalization, remember
that the program will fail many times while you're creating and debugging
it. You don't want that to suck up resources on the user's computer.
Randy.
next prev parent reply other threads:[~2013-10-19 2:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-02 0:31 ANN: PLplot plotting library with Ada bindings Jerry
2013-10-02 0:45 ` Jeffrey Carter
2013-10-03 4:39 ` Anatoly Chernyshev
2013-10-03 5:27 ` Jeffrey Carter
2013-10-04 23:55 ` Jerry
2013-10-19 2:27 ` Randy Brukardt [this message]
2013-10-22 4:20 ` Jerry
2013-11-12 15:27 ` Graham Stark
2013-11-13 22:51 ` Jerry
2013-11-15 5:16 ` Jerry
2013-11-18 15:11 ` Graham Stark
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox