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: Re: A function that cannot be called? Date: Fri, 19 Oct 2018 21:57:39 +0200 Organization: A noiseless patient Spider Message-ID: References: <99f41210-6fe2-4b4d-90ad-21a0ab108f53@googlegroups.com> <39dec2d6-7da5-4421-bb50-e4effd5a1439@googlegroups.com> Reply-To: nonlegitur@notmyhomepage.de Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 19 Oct 2018 19:57:40 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="189888e645ecebbf26e597f043adf425"; logging-data="10213"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19nbgHgaFNi2f7s16u/HmJADlQLcdsVBMs=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 Cancel-Lock: sha1:TMyf1HpOjtoe4+TriReUotblvm4= In-Reply-To: <39dec2d6-7da5-4421-bb50-e4effd5a1439@googlegroups.com> Content-Language: de-DE Xref: reader02.eternal-september.org comp.lang.ada:54662 Date: 2018-10-19T21:57:39+02:00 List-Id: On 19.10.18 19:06, AdaMagica wrote: > I do not really understand what all this is about, but: > > package What is > type Void (<>) is private; > function Create (Params: Some_Type) return Void is abstract; > private > type Void is null record; -- no values > end What; > > Void has no values (hm, a null record is a value, but it's irrelevant, since no objects exist (there is none in the private part; a body is illegal); no objects can be created because Create is abstract, so in effect Create does not exist - so it cannot be called. 41. Consume (What.Create'Access); | >>> prefix of "Access" attribute cannot be abstract If the above package is placed in some private part, then, I think, the language will guarantee that there is no way of introducing objects anywhere. From the docs of Haskell's Data.Void: "A Haskell 98 logically uninhabited data type, used to indicate that a given term should not exist." One use of all this could be: any attempt at calling the access-value passed to Consume will trigger some kind of exceptional situation. This implement works when Void is range 1..0 such that objects can be declared, but is not available with either abstract functions, as seen, or with a Void(<>) that cannot be constrained.