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: Tue, 23 Oct 2018 19:49:22 +0200 Organization: A noiseless patient Spider Message-ID: References: <99f41210-6fe2-4b4d-90ad-21a0ab108f53@googlegroups.com> <39dec2d6-7da5-4421-bb50-e4effd5a1439@googlegroups.com> <104caa52-8e0b-4699-996e-74f382c31ba7@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: Tue, 23 Oct 2018 17:49:23 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="537b2cbe902a8590459f9a1ec6abc86b"; logging-data="15394"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/GmRa3ePejF/rI3o8LQA3+Owrbbs/xAH0=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 Cancel-Lock: sha1:l4b9goTNDRSpj99iV9CKxgDm250= In-Reply-To: Content-Language: de-DE Xref: reader02.eternal-september.org comp.lang.ada:54698 Date: 2018-10-23T19:49:22+02:00 List-Id: On 23.10.18 16:57, Dmitry A. Kazakov wrote: > On 2018-10-23 16:35, Jere wrote: > >> The difficulty with compile time comes from your requirements I think. >> In order for the function to exist, the compiler needs to have it >> actually be callable. > > In which sense a non-callable function may exist? What exactly is the meaning of "callable"? The function is supposed to exist just like the empty function in {} -> {} in mathematics, I think. "Callable" is probably meaningful in contexts involving types, such as argument type pattern matching in functionist languages. Can't say if lazyness is needed in addition. Maybe "used" is a better word than "called". functions in Ada that take no argument but that still return something seem weird in a different way. If one restricts one's views to the "D -> E" pattern as the only respectalbe way of describing a function, then what is the proper signature of "function of no argument, but returning T" ? (Which is nice in that it allows naming expressions: function Pi return Float is (355.0 / 113.0); ) There might be another good bit in Ada in this regard, namely pure functions, to be got from a pragma, thus package Nope is pragma Pure (Nope); function Source return Integer; end Nope; I can't say whether this particular one approximates Haskell's absurd :: Void -> a but providing an Ada body for function Source from the pure package above and one that is actually impure is a little tricky.