comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Silly and stupid post‑condition or not ?
Date: Tue, 31 Jan 2012 14:52:59 +0100
Date: 2012-01-31T14:52:59+01:00	[thread overview]
Message-ID: <12pod8zxdo56v.16pnewlc853au$.dlg@40tude.net> (raw)
In-Reply-To: 4f27dfa5$0$6570$9b4e6d93@newsspool4.arcor-online.net

On Tue, 31 Jan 2012 13:33:41 +0100, Georg Bauhaus wrote:

> On 31.01.12 11:22, Dmitry A. Kazakov wrote:
>> On Tue, 31 Jan 2012 10:35:35 +0100, Georg Bauhaus wrote:
>> 
>>> On 31.01.12 09:54, Dmitry A. Kazakov wrote:
>>>> On Tue, 31 Jan 2012 00:11:43 +0100, Yannick Duchêne (Hibou57) wrote:
>>>>
>>>>>      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.
>>>>>
>>>>>
>>>>> Is such a post‑condition a good or bad practice in your humble or
>>>>> authoritative opinion ?
>>>>
>>>> I would say it would be a bad practice. The reason is that IMO the
>>>> postcondition must be complete, it must tell all truth or nothing. Your
>>>> prostcondition is a partial truth, it does not describe all cases when
>>>> Status is mandated to be Format_Error.
>>>
>>> One way to express a "hints only" postcondition is
>>>
>>>    with Post => True or  -- yes, mathniks, just FTR:
>>>      (if ... then ...
>>>
>>> The idea is that the partial truth, in the shape of a
>>> formal note, can later lead to an improved program
>>> structure.
>> 
>> Apply your idea to the case statement:
>> 
>> case Char is
>>    when 'A' => Put_Line ("Got A");
>> end case;
> 
> I was only picking up the idea that a case statement's completeness
> is decidable and postconditions aren't.

The case statement was designed with a mindset opposite to this idea. This
is why the alternatives of a case are required to be static, why the choice
cannot be a class-wide object.

> Nor need they be.

So are the alternatives of case. In other languages alternatives are tested
in the order of their appearance, no big deal, they say.

> Yet, incomplete
> information ("lies") can add value to the "about" part of the
> annotated thing.

Incomplete information /= exhaustiveness. Considering paraconsistent,
fuzzy, probabilistic and other logics used to handle unknown things, they
long for all alternatives to be specified even more than the conventional
logic does. In order to infer anything useful in such a logic, you need to
know something about both A and not A, since A or not A is no more true
(the law of excluded middle fails).

Using the example of the case statement, all incomplete information is
concentrated in the value of the choice. There is nothing incomplete in the
case's alternatives.

Take another example, let you see:

   x := 1;

The information about x is incomplete. You know that it could probably
accommodate the value 1, and that is. You may argue at nausea that this
"adds value", but that is not Ada, which requires the type of x manifested
before its use. And what does a type declaration? It lists all possible
values of x, exhaustively. Again, there are languages that take a different
path, so my comment is Ada's POV, of course.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2012-01-31 13:53 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-30 23:11 Silly and stupid post‑condition or not ? Yannick Duchêne (Hibou57)
2012-01-31  6:47 ` J-P. Rosen
2012-01-31 18:48   ` Jeffrey Carter
2012-01-31 22:02     ` Yannick Duchêne (Hibou57)
2012-01-31  8:54 ` Dmitry A. Kazakov
2012-01-31  9:35   ` Georg Bauhaus
2012-01-31 10:22     ` Dmitry A. Kazakov
2012-01-31 12:33       ` Georg Bauhaus
2012-01-31 13:52         ` Dmitry A. Kazakov [this message]
2012-01-31 15:34           ` Georg Bauhaus
2012-01-31 16:24             ` Dmitry A. Kazakov
2012-01-31 19:44               ` Georg Bauhaus
2012-02-01  8:41                 ` Dmitry A. Kazakov
2012-02-01 10:37                   ` stefan-lucks
2012-02-01 10:51                     ` Yannick Duchêne (Hibou57)
2012-02-01 13:49                     ` Yannick Duchêne (Hibou57)
2012-02-01 13:49                     ` Dmitry A. Kazakov
2012-02-01 16:37                       ` stefan-lucks
2012-02-02  1:50                         ` Silly and stupid post�?'condition " Randy Brukardt
2012-02-02  1:56                           ` Silly and stupid postâ?'condition or not ? Yannick Duchêne (Hibou57)
2012-02-03  2:45                             ` Silly and stupid post�?'condition or not ? Randy Brukardt
2012-02-02  8:25                         ` Silly and stupid post‑condition " Dmitry A. Kazakov
2012-02-02  9:01                           ` stefan-lucks
2012-02-02  9:18                           ` stefan-lucks
2012-02-02 10:04                             ` Dmitry A. Kazakov
2012-01-31 22:08         ` Yannick Duchêne (Hibou57)
2012-01-31 17:28 ` Dmitry A. Kazakov
2012-01-31 22:12   ` Yannick Duchêne (Hibou57)
2012-02-01  8:49     ` Dmitry A. Kazakov
2012-02-01  8:36 ` Stephen Leake
2012-02-01 16:30   ` Silly and stupid post-condition " Adam Beneschan
2012-02-02  9:40     ` Stephen Leake
2012-02-02 13:20       ` Georg Bauhaus
2012-02-02 13:35         ` Yannick Duchêne (Hibou57)
2012-02-03  3:13       ` Randy Brukardt
2012-02-03  3:33         ` Yannick Duchêne (Hibou57)
2012-02-03  8:12         ` Simon Wright
2012-02-07  2:29           ` BrianG
2012-02-07 10:43             ` Simon Wright
2012-02-08  2:25               ` BrianG
2012-02-07 21:15             ` Robert A Duff
2012-02-03  9:11         ` Dmitry A. Kazakov
2012-02-04  3:27           ` Randy Brukardt
2012-02-04 10:15             ` Dmitry A. Kazakov
2012-02-03 12:25         ` Phil Thornley
2012-02-04  9:30         ` Phil Thornley
2012-02-04 12:02         ` Phil Thornley
2012-02-05  6:18           ` Randy Brukardt
2012-02-05 10:23             ` Phil Thornley
2012-02-05 10:55               ` Yannick Duchêne (Hibou57)
2012-02-05 15:03               ` Robert A Duff
2012-02-05 18:04                 ` Phil Thornley
2012-02-05 21:27                   ` Robert A Duff
2012-02-05 23:09                     ` Phil Thornley
2012-02-07  2:05               ` Randy Brukardt
2012-02-07  9:38                 ` Dmitry A. Kazakov
2012-02-05 11:31             ` Yannick Duchêne (Hibou57)
2012-02-05 14:50             ` Robert A Duff
2012-02-07  2:11               ` Randy Brukardt
2012-02-07  2:34             ` BrianG
2012-02-07  4:38               ` Yannick Duchêne (Hibou57)
2012-02-09  3:10               ` Randy Brukardt
2012-02-04 23:07         ` Stephen Leake
2012-02-05  2:49           ` Yannick Duchêne (Hibou57)
2012-02-05  6:29           ` Randy Brukardt
2012-02-05 11:40             ` Yannick Duchêne (Hibou57)
2012-02-07  1:36               ` Randy Brukardt
2012-02-05 15:16             ` Robert A Duff
2012-02-06  4:56               ` Yannick Duchêne (Hibou57)
2012-02-06 14:39                 ` Robert A Duff
2012-02-06 16:12                   ` Yannick Duchêne (Hibou57)
2012-02-07  1:46               ` Randy Brukardt
2012-02-07 17:24                 ` Robert A Duff
2012-02-03  6:26       ` J-P. Rosen
2012-02-03  9:12         ` Dmitry A. Kazakov
2012-02-03  9:48           ` Yannick Duchêne (Hibou57)
2012-02-03 11:09             ` Dmitry A. Kazakov
2012-02-03 11:40               ` Yannick Duchêne (Hibou57)
2012-02-03 13:18                 ` Dmitry A. Kazakov
2012-02-03 14:14                   ` Yannick Duchêne (Hibou57)
2012-02-03 14:45                     ` Dmitry A. Kazakov
2012-02-04  3:16           ` Randy Brukardt
2012-02-04  6:27             ` Yannick Duchêne (Hibou57)
2012-02-04 10:47             ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox