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!mx02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Uninitialized out parameters. Date: Fri, 8 Apr 2016 09:32:23 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <3be79ab3-ebc7-4169-9713-d50349662403@googlegroups.com> <51041ba8-3243-46bc-b97d-b106d4b357e2@googlegroups.com> NNTP-Posting-Host: bqgfK7NL3xTHnr0WRaLl4g.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:30048 Date: 2016-04-08T09:32:23+02:00 List-Id: On 08/04/2016 01:02, Randy Brukardt wrote: > "AdaMagica" wrote in message > news:51041ba8-3243-46bc-b97d-b106d4b357e2@googlegroups.com... >> Am Donnerstag, 7. April 2016 11:57:02 UTC+2 schrieb >> Stefan...@uni-weimar.de: >> >>>> (2) The latter can be written in current Ada 2012: (that is, with TC1 >>>> implemented) >>>> function Y return T is (raise Program_Error); >>> >>> Great! I wasn't aware of that. I always thought, the expression in >>> brackets had to be of type T. >>> >>> Stefan >> >> A raise_expression matches any type. See RM. > > Right. One can think of it sort of like "bottom" in a functional language - > it represents the "not a value" of any type. (And touch it and you die.) > > OTOH, like me, you may not want to think of functional languages much. ;-) Yes, better think it typed! It is same as an IEEE float which values are real U {NaN, +Inf, -Inf}. Propagating exceptions is a sort of value. In function Y return T is (raise Program_Error); we assume that T consists of values of T values and exceptions of all sorts. That is weakly typed, a bit. But it also a way how to spell Y's post-condition: "T or Program_Error raised" could be a type Y returns. That would make an implementation (raise Constraint_Error) illegal. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de