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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9747037d09060687 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!40g2000prx.googlegroups.com!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: A proposal for formal packages matching Date: Mon, 15 Dec 2008 07:43:47 -0800 (PST) Organization: http://groups.google.com Message-ID: <24af3981-70bd-48fb-95e7-8acb2c2521de@40g2000prx.googlegroups.com> References: <1b1brfydbng85$.106aaoguop29f.dlg@40tude.net> NNTP-Posting-Host: 153.98.68.197 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1229355827 16281 127.0.0.1 (15 Dec 2008 15:43:47 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 15 Dec 2008 15:43:47 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 40g2000prx.googlegroups.com; posting-host=153.98.68.197; posting-account=pcLQNgkAAAD9TrXkhkIgiY6-MDtJjIlC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.0.12) Gecko/20070718 Red Hat/1.5.0.12-3.el5 Firefox/1.5.0.12,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:3967 Date: 2008-12-15T07:43:47-08:00 List-Id: On Dec 15, 2:29 pm, "Dmitry A. Kazakov" wrote: > On Mon, 15 Dec 2008 04:13:47 -0800 (PST), Ludovic Brenta wrote: > > On Dec 15, 11:21 am, "Dmitry A. Kazakov" > > wrote: > >> There seems one overlooked thing in the rules controlling matching formal > >> packages. An instance of generic child package does not match as an > >> instance of the generic parent. > > >> I mean the following: > > >> generic > >> package Generic_A is > >> end Generic_A; > > >> package A is new Generic_A; > > >> generic > >> package Generic_A.Generic_B is > >> end Generic_A.Generic_B; > > >> package AB is new A.Generic_B; > > >> generic > >> with package A is new Generic_A (<>); > >> package Generic_Foo is > >> end Generic_Foo; > > >> package Foo is new Generic_Foo (AB); > >> -- Error: AB is not an instance of Generic_A > > >> Semantically, AB being an extension of Generic_A can be considered an > >> instance of. > > > No, because semantically, packages are not types. They are units of > > visibility. And they are orthogonal to type extension, dynamic > > dispatching and object-oriented programming if that's what you have in > > mind. > > I didn't. (For that matter the concept of type extension is questionable.) > > I meant exclusively visibility. A child package has parent's declaration > visible in its body. > > package Foo is new Generic_Foo (AB); > > should read, "take AB or any of its parents, which is an instance of > Generic_A." > > [ Presently it is insolvable in an implicit form, because the actual of the > parent package has no name. Differently to the formal parameters, which > actuals are anonymous "outside," but named "inside," parents are anonymous > for all sights. ] The child's body sees its parent's private part but what does that have to do with the generic? The generic only needs visibility into the parent's public part. Assuming the language allowed you to pass a child as the actual for a formal that requires a parent, what would this buy you? If you see the child (AB) you can also see its parent (A) so I can't think of a case where passing the parent as the actual is a problem. -- Ludovic Brenta.