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!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!.POSTED!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: 'Protected' abstract subprograms Date: Wed, 15 Jan 2014 09:11:03 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <839fee13-2743-49f6-a7f3-f95578386201@googlegroups.com> <1aav8alqsnqqv.5urmifgwh1mv.dlg@40tude.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls7.std.com 1389795063 28780 192.74.137.71 (15 Jan 2014 14:11:03 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 15 Jan 2014 14:11:03 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:JVToeCggkk7zXMvdJ4RcEC69+9c= X-Received-Bytes: 3177 X-Received-Body-CRC: 3197731403 Xref: news.eternal-september.org comp.lang.ada:18181 Date: 2014-01-15T09:11:03-05:00 List-Id: "Dmitry A. Kazakov" writes: > Hmm, of course they can and do. Do you mean legality of public part not > depending on the legality of private parts? Even they do. I think the principle is: The private part cannot affect the legality of clients. It seems like a good principle, but it is violated all over the place. Search for "see 12.3" in the RM to find a bunch. For example: generic type Formal is tagged limited private; package A is private task type T; type Derived is new Formal with record Limited_Component: T; end record; end; with A; package B is type Actual is tagged null record; package Instance is new A(Actual); end; Package B is illegal, because of something going on the private part of A -- without Limited_Component it would be legal. With Limited_Component, B.Instance.Derived is a nonlimited type with a limited component, which is illegal. I think maybe this is an indication that Ada's macro-expansion model of generics is a wrong approach. > Yep, that's what I meant under "cooperative" privacy. For many > applications, and the number of is growing rapidly, a "non-cooperative" > privacy is needed as well. Well, in a language that allows Unchecked_Conversion, address clauses, machine code inserts, etc., I don't see any way to achieve non-cooperative privacy within a single process. You can achieve it in Ada via remote procedure calls, though. > Just one trivial example of slack privacy. You cannot hide default values: > > type T is private; If you have: function V return T; then the default value is hidden. > procedure Foo (X : T := V); > private > type T is ... > > Should have been something like: > > type T is private; > procedure Foo (X : T := <>); -- The value is deferred > private > type T is ... > for Foo'Default (X) use V; -- Here it is, whichever syntax you prefer I don't see a need for any such feature. - Bob