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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c4bd2a19251049b1 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news3.google.com!feeder.news-service.com!94.75.214.39.MISMATCH!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: best practice: error handling Date: Sat, 11 Jun 2011 15:38:10 +0200 Organization: Ada @ Home Message-ID: References: <0b95a2a1-6e3d-4ad1-a832-e3099a9bce37@v8g2000yqb.googlegroups.com> NNTP-Posting-Host: fGpkzlUfcOSQVUiZJOXhgg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/11.11 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Xref: g2news2.google.com comp.lang.ada:20719 Date: 2011-06-11T15:38:10+02:00 List-Id: Le Tue, 31 May 2011 19:13:16 +0200, Vinzent Hoefler = <0439279208b62c95f1880bf0f8776eeb@t-domaingrabbing.de> a =C3=A9crit: > If you kind of expect the call to fail under normal conditions, a prop= er > out-Parameter (like "Success" ;) can be added. > > Keep in mind, that returning some error requires a function, and until= = > now > functions can't have "out"-parameters, so returning an "error code" is= = > only > possible for those subroutines which do not need to have = > "out"-parameters. I strongly suspect this is precisely the reason why Ada 2012 will add ou= t = parameters to function ;) First, I though this was a silly idea, and later, from time to time, I = though this was indeed a good idea, at least to return status from = function, without the need to define wrapper types every where (at least= , = while Ada do not have provision to return proper tuples like functional = = languages do). Moreover, a function may still be conceptually Pure, even= = with out parameters ;) -- = =E2=80=9CSyntactic sugar causes cancer of the semi-colons.=E2=80=9D [Ep= igrams on = Programming =E2=80=94 Alan J. =E2=80=94 P. Yale University] =E2=80=9CStructured Programming supports the law of the excluded muddle.= =E2=80=9D [Idem] =E2=80=9Cc++; /* this makes c bigger but returns the old value */=E2=80=9D= [Anonymous]