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!news2.google.com!goblin1!goblin2!goblin.stu.neva.ru!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Constraints in extended return Date: Sat, 19 Mar 2011 15:55:00 +0000 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx03.eternal-september.org; posting-host="dFCm8HWntFqmDIilBLqEJQ"; logging-data="26386"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19biRrwEOKrgYft1r2b3VcIflrdmw6I/WQ=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin) Cancel-Lock: sha1:Lp9mvEFbrTIr0etOJ3zGSpAxcTY= sha1:Bi93YSSUPhZ24oq3iJIbJTnAeAI= Xref: g2news1.google.com comp.lang.ada:18317 Date: 2011-03-19T15:55:00+00:00 List-Id: Robert A Duff writes: > 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); Thanks, that's what I thought would be the case. This will constrain my solution :-) but we all need boundaries! > - Bob