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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Diamond diagram for 'with' Date: Wed, 21 Feb 2018 19:38:24 -0600 Organization: JSA Research & Innovation Message-ID: References: Injection-Date: Thu, 22 Feb 2018 01:38:25 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="22429"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:50536 Date: 2018-02-21T19:38:24-06:00 List-Id: "Dmitry A. Kazakov" wrote in message news:p6k68f$9li$1@gioia.aioe.org... >I would ask language lawyers regarding multiple with. > > Consider this: > > limited with Root.A; > package Root is > end Root; > > package Root.A is > type T is ...; > end Root.A; > > with Root.A; > package Root.B is > end Root.B; > > Now Root.B has both limited (inherited from Root) and full "with" of > Root.A. So, may Root.B use Root.A.T? It cannot according to "limited with" > and it can due to full "with". Which one to win? Off the top of my head, it should be the "full with". Generally, Ada allows one to open more visibility, but you can't remove it. Deriving this formally would be somewhat painful, but it has to be true, since the motivating use for limited with is something like: limited with P; package Q is ... end Q; limited with Q; package P is ... end P; with Q; package body P is -- Q is normally visible here. end P; If the limited with "won" in the body, one could never access the full package in the body, which would make actually implementing any mutually dependent package hard. (You may want to call some primitive routine declared in Q in the body of P, but that isn't possible for a "limited with"). Since all withs work basically the same way, the same has to be true for a child package. BTW, Root.A.T would be legal either way. But if it came from the limited with, it would be an incomplete type (which has its own limitations). Randy.