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: A function that cannot be called? Date: Thu, 18 Oct 2018 16:30:08 -0500 Organization: JSA Research & Innovation Message-ID: References: <7ab688d0-b6b8-459c-b5b7-39b6c35daad2@googlegroups.com> Injection-Date: Thu, 18 Oct 2018 21:30:09 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="31617"; 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:54641 Date: 2018-10-18T16:30:08-05:00 List-Id: "G.B." wrote in message news:pqanbb$hl5$1@dont-email.me... > On 18.10.18 19:03, AdaMagica wrote: >> Am Donnerstag, 18. Oktober 2018 14:14:32 UTC+2 schrieb G.B.: >>> package What is >>> >>> type Void (<>) is private; >>> >>> function Impossible (X : T) return Void; >>> >>> private >> ... >>> end What; >> >> Of course this is possible. Declarations of objects of type Void must >> have an initial value, which can be provided via the "constructor" >> Impossible: >> >> X: Void := Impossible (T0); > > Impossible needs to return a value. But a returned object can > neither be declared nor a value constructed, since type Void > has an unknown discriminant so that no initial constraint > can be given anywhere. It can always be given in the body of the package, since the full type for Void has to have some declaration with "known" discriminants. (Unknown discriminants aren't allowed on full types.) And that's the point: with this declaration, the only objects that can be created are those created by the package, which is fully within the control of the creator of the abstraction. If you don't want any objects at all (which would be weird, as types have no real use until some object is created of it or a descendant), then don't create any. Randy.