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 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: A function that cannot be called? Date: Thu, 18 Oct 2018 14:14:30 +0200 Organization: A noiseless patient Spider Message-ID: Reply-To: nonlegitur@notmyhomepage.de Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 18 Oct 2018 12:14:31 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="1281b14f024645c2178d3ddbbc38734b"; logging-data="9583"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Yyf7d+Sb9JFzKQj8XZWAeCNxuv/67/1o=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 Cancel-Lock: sha1:HINllvbKbxqom1neCQucGMLtzS4= Content-Language: de-DE X-Mozilla-News-Host: news://news.arcor.de:119 Xref: reader02.eternal-september.org comp.lang.ada:54627 Date: 2018-10-18T14:14:30+02:00 List-Id: There is a type declaration, I rememberd, in Ada, that does not allow any object of the type to be declared. I think the type should be along the lines below. Is this correct? Then, a function that nominally returns objects of this type should be impossible to call. Is this right, too? generic type T(<>) is limited private; -- gen. arg. type package What is type Void (<>) is private; function Impossible (X : T) return Void; private package Inner is type Void (<>) is private; private type Void is record null; end record; end Inner; type Void is new Inner.Void; end What; (If current Ada could still pass by reference in both call direction and return direction, then I'd have added *limited* to the Voids' declarations. Without it, a body of Impossible is closer to becoming possible by using Convention => Ada together with an 'Address clause on a Result object. I think.)