comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Limited use for limited with?
Date: Tue, 5 Oct 2010 02:25:08 -0500
Date: 2010-10-05T02:25:08-05:00	[thread overview]
Message-ID: <i8ejsn$4fu$1@munin.nbi.dk> (raw)
In-Reply-To: 292dd0bd-1fc4-4715-bb70-7655d0dc04eb@j24g2000yqa.googlegroups.com

"Maciej Sobczak" <see.my.homepage@gmail.com> wrote in message 
news:292dd0bd-1fc4-4715-bb70-7655d0dc04eb@j24g2000yqa.googlegroups.com...
On 29 Wrz, 09:51, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
>> No, that makes it (the public interface) more clear. Pointer is an
>> implementation detail to be hidden.
>
>Reference leak is not an implementation detail, it is a very important
>part of the contract.

Dmitry is right, the *reference* ought to be part of the object, so a leak 
is impossible. In any case, using an access type in the specification of 
Register doesn't do anything to say how long the access will be used for, so 
that doesn't help any. (C and C++ interfaces are notorious for this problem: 
there is often no way to tell whether the access needs to remain valid until 
some later time, nor what time that is.)

>No way. There are *many* Registers, meaning that a single object can
>be registered in several registries, not just one. Will you suggest
>passing an array of registries to the constructor? I hope not.

This sounds like chaos, not a design. There is no way to figure out anything 
that happens with callbacks, registered or not. Callbacks are dubious to 
begin with; moreover, when objects need to be registered that should only 
happen with a very small number of places (hopefully one).

Note that Claw uses exactly the design that Dmitry is describing. Each 
Window can be linked into a handful of data structures -- but we use 
Finalize to ensure it is not linked on any when the object is destroyed. The 
alternative of making all of this the client's problem is simply not "the 
Ada way". (It also would have made Claw technical support impossible; we had 
plenty of bizarre problems even with all of the automatic cleanup, some 
because compiler bugs didn't always clean things up. Without that cleanup, 
it would have been total chaos -- it is viritually impossible to manually 
clean up objects when exceptions happen [some are always missed] -- and 
exceptions are *always* happening in an Ada program [especially during 
testing].)

>The problem with your approach is that it tries to bend the design of
>the system in order to work around some language limitation. I prefer
>having it the other way round.

The "design" sounds more like copying bad ideas from some other 
implementation for some other programming language.

>In short, I still don't see a plausible solution to my problem and
>from all poor solutions that I'm aware of, the one I already use seems
>to be the simplest.

When you start with a poor design, it's not surprising you can only find 
poor solutions...

                                Randy.





  parent reply	other threads:[~2010-10-05  7:25 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-28  7:37 Limited use for limited with? Maciej Sobczak
2010-09-28  9:04 ` Alex R. Mosteo
2010-09-30  7:24   ` Stephen Leake
2010-09-30  9:21     ` Alex R. Mosteo
2010-09-28  9:18 ` Ludovic Brenta
2010-09-28 12:59   ` Maciej Sobczak
2010-09-28 13:45     ` Dmitry A. Kazakov
2010-09-28 21:57       ` Maciej Sobczak
2010-09-29  6:03         ` Ludovic Brenta
2010-09-29  8:25           ` Maciej Sobczak
2010-09-29  7:51         ` Dmitry A. Kazakov
2010-09-29  8:38           ` Maciej Sobczak
2010-09-29  9:16             ` Dmitry A. Kazakov
2010-09-29 12:22               ` Maciej Sobczak
2010-09-29 13:41                 ` Dmitry A. Kazakov
2010-09-29 15:07                   ` Georg Bauhaus
2010-09-29 19:22                     ` Dmitry A. Kazakov
2010-09-29 20:51                   ` Maciej Sobczak
2010-09-29 21:18                     ` Dmitry A. Kazakov
2010-10-05  7:35                     ` Randy Brukardt
2010-10-08  8:05                       ` Maciej Sobczak
2010-10-09  6:29                         ` Randy Brukardt
2010-10-05  7:25             ` Randy Brukardt [this message]
2010-10-08  8:23               ` Maciej Sobczak
2010-10-09  6:13                 ` Randy Brukardt
2010-10-10 14:13                   ` Maciej Sobczak
2010-10-11  6:23                     ` Randy Brukardt
2010-10-12 19:29                       ` Maciej Sobczak
2010-10-12 20:19                         ` Dmitry A. Kazakov
2010-10-13  2:09                         ` Randy Brukardt
2010-10-13  8:44                           ` Georg Bauhaus
2010-10-15  0:59                             ` Randy Brukardt
2010-10-13  9:43                           ` Maciej Sobczak
2010-09-28 15:15     ` Ludovic Brenta
2010-09-28 22:04       ` Maciej Sobczak
2010-09-28 15:54   ` Robert A Duff
2010-09-30  7:27   ` Stephen Leake
2010-09-30  7:33     ` Ludovic Brenta
2010-09-30 16:03     ` Adam Beneschan
2010-10-07 11:55       ` Stephen Leake
2010-10-07 18:27         ` Martin Krischik
2010-10-07 21:30           ` Adam Beneschan
2010-10-09  6:29             ` Martin Krischik
2010-10-09 18:35               ` Robert A Duff
2010-10-08  0:07           ` Randy Brukardt
2010-10-09  6:21             ` Martin Krischik
2010-09-28  9:32 ` Vadim Godunko
2010-09-28 11:34 ` stefan-lucks
2010-09-28 13:15   ` stefan-lucks
2010-09-28 16:55 ` Adam Beneschan
2010-09-28 17:31   ` Robert A Duff
2010-09-28 19:24     ` Adam Beneschan
2010-09-28 20:32       ` Vadim Godunko
2010-09-28 21:32         ` Adam Beneschan
replies disabled

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