From: Maciej Sobczak <no.spam@no.spam.com>
Subject: Re: Controlled types and exception safety
Date: Tue, 06 Dec 2005 10:00:39 +0100
Date: 2005-12-06T10:00:39+01:00 [thread overview]
Message-ID: <dn3jvn$fdg$1@sunnews.cern.ch> (raw)
In-Reply-To: <8sKdnXNeIZMxIg3eRVn-ig@comcast.com>
tmoran@acm.org wrote:
>>But X := Y overwrites X before calling Adjust on it, so you can't store
>>the backup copy, or any way of accessing the backup copy, in X.
>
> Right. But Adjust, in case of problems, could still find the copy of
> the old X in the "to be deleted" backup queue and restore X from there.
> I didn't say this was nice, just that it was possible. ;)
Except that it doesn't solve anything. The whole issue with this
commit-or-rollback implementation is that it should not just suppress
the exception and pretend that nothing happened - it should guarantee
the old state and at the same time let the exception fly out to the
place where it could be actually handled, whatever that means in the
given context. I've started with the assumption that function ":=" is
allowed to fail - in the sense that it can raise exceptions. It's not,
and therefore there is no point in implementing any failover features in
it. It has to either guarantee the success or not be provided at all and
the type should be limited.
This brings me to the next problem. Let's say that I provide a separate
procedure Duplicate or Copy or Assign or whatever with the
commit-or-rollback guarantees for some type (like Stack). Now, some of
the types in my program will have ":=" for assignment, and some others
will have the Copy procedure, but not ":=".
I want to create a generic container or some other component that will
copy things around internally. It has to use ":=" for some types (like
Integer) and Copy for others (like Stack).
In C++ I solve this problem (aside the fact that there is no problem in
the first place) with template type traits or some other application of
template specializations.
What about Ada?
--
Maciej Sobczak : http://www.msobczak.com/
Programming : http://www.msobczak.com/prog/
next prev parent reply other threads:[~2005-12-06 9:00 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-30 13:57 Controlled types and exception safety Maciej Sobczak
2005-11-30 15:06 ` Dmitry A. Kazakov
2005-11-30 16:19 ` Maciej Sobczak
2005-12-01 0:05 ` Stephen Leake
2005-12-01 9:21 ` Dmitry A. Kazakov
2005-12-01 10:46 ` Maciej Sobczak
2005-12-01 15:08 ` Dmitry A. Kazakov
2005-12-02 4:17 ` Randy Brukardt
2005-12-02 9:29 ` Maciej Sobczak
2005-12-02 18:12 ` tmoran
2005-12-02 19:15 ` Robert A Duff
2005-12-02 21:42 ` tmoran
2005-12-06 9:00 ` Maciej Sobczak [this message]
2005-12-06 9:50 ` Dmitry A. Kazakov
2005-12-06 18:34 ` Jeffrey R. Carter
2005-12-06 19:34 ` Randy Brukardt
2005-12-06 21:20 ` Dmitry A. Kazakov
2005-12-07 1:57 ` Jeffrey R. Carter
2005-12-08 0:50 ` Randy Brukardt
2005-12-08 19:37 ` Jeffrey R. Carter
2005-12-09 2:36 ` Randy Brukardt
2005-12-09 6:33 ` Jeffrey R. Carter
2005-12-09 20:35 ` Randy Brukardt
2005-12-10 7:53 ` Jeffrey R. Carter
2005-12-06 20:43 ` Dmitry A. Kazakov
2005-12-07 2:00 ` Jeffrey R. Carter
2005-12-07 10:01 ` Dmitry A. Kazakov
2005-12-02 23:21 ` Robert A Duff
2005-11-30 17:46 ` Jean-Pierre Rosen
2005-11-30 21:02 ` Jeffrey R. Carter
2005-11-30 22:06 ` Björn Persson
2005-11-30 23:52 ` Randy Brukardt
2005-12-01 5:26 ` Jeffrey R. Carter
2005-12-02 23:51 ` Robert A Duff
2005-12-06 11:41 ` Peter C. Chapin
2005-12-06 12:50 ` Jean-Pierre Rosen
2005-12-06 13:06 ` 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