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 X-Google-Thread: 103376,ad06d2d7cb045687 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.74.201 with SMTP id w9mr16200568pbv.0.1328086225364; Wed, 01 Feb 2012 00:50:25 -0800 (PST) Path: lh20ni247868pbb.0!nntp.google.com!news2.google.com!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: =?utf-8?B?U2lsbHkgYW5kIHN0dXBpZCBwb3N04oCRY29uZGl0aW9uIG9yIG5vdMKgPw==?= Date: Wed, 1 Feb 2012 09:49:47 +0100 Organization: cbb software GmbH Message-ID: References: <1p9stpwo0k4ma$.1hznr6by4cbdt$.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: FbOMkhMtVLVmu7IwBnt1tw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Date: 2012-02-01T09:49:47+01:00 List-Id: On Tue, 31 Jan 2012 23:12:57 +0100, Yannick Duch�ne (Hibou57) wrote: > Le Tue, 31 Jan 2012 18:28:54 +0100, Dmitry A. Kazakov > a �crit: > >> On Tue, 31 Jan 2012 00:11:43 +0100, Yannick Duch�ne (Hibou57) wrote: >> >>> type Parsed_Type (Status : Parsed_Status_Type) is record >>> case Status is >>> when Parsed => >>> Instance : Instance_Type; >>> when Format_Error => >>> null; >>> end case; >>> end record; -- Parsed_Type >>> >>> function Parsed (S : String) return Parsed_Type >>> with Post => >>> (if S'Length not in Image_Length_Type then >>> Parsed'Result.Status = Format_Error); >>> -- There may be other failure conditions. >> >> Returning the discussion from the astral spheres back to the topic. A >> better design could be to split Format_Error into Length_Error and other >> errors. Then for Parsed the postcondition would become complete for one >> case: if and only if S'Length not in Image_Length_Type then the result is >> Length_Error. > > Could be an idea if the program could make use of this extra information. > But it won't, a program won't fix an erroneous image received as input, > and a Length_Error will result in the same behavior as with a Format_Error > result. What is the point in exempting it in the postcondition? The Georg's idea: do what looks simple enough and ignore the rest, maybe nobody would ask for that? I argue that this attitude is characteristic to bad design. Apart from thousands other reasons, like leaking implementation details/faults into the specification etc. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de