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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,6f580d48a3449630 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!news.mv.net!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Constraints in extended return Date: Sat, 19 Mar 2011 09:30:18 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1300541417 5511 192.74.137.71 (19 Mar 2011 13:30:17 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sat, 19 Mar 2011 13:30:17 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:YG44gUnsjCcO14buXN/Y2wCtdRA= Xref: g2news1.google.com comp.lang.ada:18315 Date: 2011-03-19T09:30:18-04:00 List-Id: Simon Wright writes: > This is all very well for providing a value where no constraint is > otherwise imposed, for example as an actual in a subprogram call, but > what about the case where there is a prior constraint? You get Constraint_Error if the constraint is wrong. But this isn't directly related to extended return statements. You get the same thing for old-fashioned returns: function F(...) return String is begin ... return "Hello"; end F; X : String (1..100); X := F(...); -- Constraint_Error > Is there any way for the extended return to determine the constraints of > the 'target'? No. You can do that for 'out' parameters, but unfortunately not for function results. So normally, you would avoid constraining at the call site, and do things like: Output : constant Complex_Matrix := Transpose (Input); - Bob