From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c08a7609345f4e5,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!c10g2000yqh.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Limited use for limited with? Date: Tue, 28 Sep 2010 00:37:04 -0700 (PDT) Organization: http://groups.google.com Message-ID: <853314bc-0f79-435f-86a5-d7bcdd610731@c10g2000yqh.googlegroups.com> NNTP-Posting-Host: 137.138.182.236 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1285659424 17152 127.0.0.1 (28 Sep 2010 07:37:04 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 28 Sep 2010 07:37:04 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: c10g2000yqh.googlegroups.com; posting-host=137.138.182.236; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:14284 Date: 2010-09-28T00:37:04-07:00 List-Id: 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? -- Maciej Sobczak * http://www.inspirel.com