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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,da85d9aaf769b16a X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!bolzen.all.de!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Generic package parameters not externally visible : what's the rational ? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Wed, 28 Oct 2009 10:09:41 +0100 Message-ID: <10eygvuzeit9g.xwy2wanxoxgf$.dlg@40tude.net> NNTP-Posting-Date: 28 Oct 2009 10:09:41 CET NNTP-Posting-Host: 53bee1a1.newsspool4.arcor-online.net X-Trace: DXC=ghUO]9^e]YC@k=MdN::NBI4IUK?kNZ@K[6LHn;2LCVN7enW;^6ZC`DIXm65S@:3>O On Tue, 27 Oct 2009 16:08:09 -0500, Randy Brukardt wrote: > "Robert A Duff" wrote in message > news:wcciqe26w5q.fsf@shell01.TheWorld.com... >> "Hibou57 (Yannick Duch�ne)" writes: >> >>> Still the time for my two cents of the day : parameters of generic >>> packages are not externally visible. I use to read in a few places on >>> the web, this is so to preserve type privacy, but without any examples >>> which could illustrate this view. >>> >>> What's the rational behind this ? >> >> I don't think there is any rationale. It makes perfect sense >> for them to be visible, but they're not. I guess it was just >> a minor mistake in Ada 83, and it's never been thought important >> enough to fix in later versions. I don't see any way in >> which this rule "preserves type privacy". > > I'm not sure that it "makes perfect sense" for them to be visible: it would > surely increase the chance of name collisions outside of the package. Sorry, but that is a "generic" property of anything declared in a generic package. Two instances of the same generic packages always collide when "use"-ed. > Indeed, I find that it makes "perfect sense" for them not the visible: they > are not part of the package that gets instantiated. I argue that they are. Each formal parameter can be thought as instantiated (from the actual) in the package, rather than passed from outside. > That's clear from the > syntax (they're outside the package). You're going to say that discriminants > are outside of the type, too, but they're also visible. I can't argue with > that beyond saying that that placement of discriminants is just awful; I > place them in the wrong place and continually forget to include them in > aggregates because they're well away from the other components. That depends on the mental model of the discriminant. If the discriminant is a type constraint, then you are right. But in Ada this concept, if ever existed, has been eroded. Presently discriminant is merely an immutable component. I am also in favor the "constraint" model, and yes, in this model it would be reasonable to make discriminants invisible, e.g. when they are used for construction and then dropped. But that is not the Ada model now. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de