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!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!cs.uu.nl!weretis.net!feeder4.news.weretis.net!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: 'Protected' abstract subprograms Date: Wed, 15 Jan 2014 17:10:02 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <839fee13-2743-49f6-a7f3-f95578386201@googlegroups.com> <1aav8alqsnqqv.5urmifgwh1mv.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: loke.gir.dk 1389827403 10321 69.95.181.76 (15 Jan 2014 23:10:03 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Wed, 15 Jan 2014 23:10:03 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:18189 Date: 2014-01-15T17:10:02-06:00 List-Id: "Robert A Duff" wrote in message news:wcc38kpgcui.fsf@shell01.TheWorld.com... > adambeneschan@gmail.com writes: > >> Or it could just mean that Ada didn't provide a complete enough way >> for generics to put conditions on the actual parameters.You can say >> "type T is private;", in which case the actual must be nonlimited; or >> you can say "type T is limited private;", in which case the actual may >> be limited or nonlimited. But you don't have a way to say "the actual >> must be limited", which is what would be needed here. > > Yes, that approach could work, but there are dozens of these "generic > private part" rules in the RM, and I suspect they all break privacy. But Adam's point still holds: with enough ability to qualify the actuals, these rules aren't needed. The problem is really one of trade-off of capability vs. proper qualification. If we did have a way to carefully specify what is allowed, in many cases you'd need many copies of a generic unit in order to cover the general case. I forget the exact case, but I recall something like that fairly recently -- we wanted to require some property to match on generic formals, but then many generics would have to be duplicated in order that they would work both with and without that property. (Was it predicates? Can't remember anymore.) To really get proper working, you have to have "with property", "without property", and "don't care about property", but of course the latter brings up the legality issues again. In any case, when I was talking about Ada taking privacy seriously, I wasn't thinking about (or caring about) generic instantiation. There is no real privacy for generic specifications, nor can there be (at least with the model of instantiation that Ada uses). [After all, Ada essentially has special rules for the meaning of Legality Rules in generic units - those override all other language principles, whether or not that is a good idea.] Privacy only really matters for concrete things like packages or instances of generic packages. My point was that that doesn't allow pricavy breaking (for Legality Rules) within normal packages. I can't think of any exceptions to that - there probably is one that I've forgotten but I doubt it invalidates the point. Randy.