comp.lang.ada
 help / color / mirror / Atom feed
From: "Alex R. Mosteo" <alejandro@mosteo.invalid>
Subject: Re: Limited use for limited with?
Date: Tue, 28 Sep 2010 11:04:41 +0200
Date: 2010-09-28T11:04:41+02:00	[thread overview]
Message-ID: <i7sb68$kft$1@news.eternal-september.org> (raw)
In-Reply-To: 853314bc-0f79-435f-86a5-d7bcdd610731@c10g2000yqh.googlegroups.com

Maciej Sobczak wrote:

> I have found a problem with the intended application of limited with.
> 
> Consider a package specifying some object-oriented construct:
> 
> package Objects is
> 
>    type Object is interface;
>    type Object_Access is access all Object'Class;
> 
>    procedure Do_Something (X : in out Object) is abstract;
> 
> end Objects;
> 
> In such cases I routinely define the XYZ_Access type and later use it
> wherever pointers to class-wide XYZ are needed.
> 
> Now consider a package that uses the above in a limited way (pun
> intended), where only pointers to class-wide type are needed:
> 
> with Objects;
> package Object_Users is
> 
>     procedure Use_Object (X : Objects.Object_Access);
> 
> end Object_Users;
> 
> The problem is that is some cases it would be more convenient (or just
> more self-documenting from the design perspective) to do limited with
> instead, but unfortunately this makes Object_Access unavailable. It is
> OK to use anonymous access type, at least in some cases like here:
> 
>     procedure Use_Object (X : access Objects.Object'Class);
> 
> but I find that uncomfortable - after all, the proper access type is
> already defined for exactly this purpose.
> 
> In such cases, where the design intent is pretty clear (pass around
> references to Objects) I find that limited with does not really bring
> the functionality that it is supposed to provide. In some more
> involving cases I was forced to introduce additional and completely
> artificial packages, where limited with would be a perfect fit.
> 
> Any thoughts on this?

Completely unhelpful on my part -- but my limited (ha) attempts at using 
"limited with" have been a failure. I'm no expert at OO or C++, like you, so 
I can't bring any expertise to the table.

Something that can be of interest in this context is a discussion that 
happened not too long ago (half a year?) in some mailing list -- I thought 
it was the GAP one, but combing the topics I can't find it. People trying to 
do "proper" OO with the new Ada features was complaining about some 
unavoidable quirks. The discussion point was on the truth of "unavoidable". 
I'm failing at locating it, if it rings some bells for someone...

Alex.

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




  reply	other threads:[~2010-09-28  9:04 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 [this message]
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
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