comp.lang.ada
 help / color / mirror / Atom feed
From: "Yannick Duchêne (Hibou57)" <yannick_duchene@yahoo.fr>
Subject: Re: What about a Static_Assertion?
Date: Tue, 23 Jul 2013 20:57:05 +0200
Date: 2013-07-23T20:57:05+02:00	[thread overview]
Message-ID: <op.w0ouxfh7ule2fv@cardamome> (raw)
In-Reply-To: 7thagxnbdrkc$.1byplk3eqgza4.dlg@40tude.net

Le Tue, 23 Jul 2013 20:43:19 +0200, Dmitry A. Kazakov  
<mailbox@dmitry-kazakov.de> a écrit:

> On Tue, 23 Jul 2013 20:07:54 +0200, Yannick Duchêne (Hibou57) wrote:
>
>> Don't you believe it would be great to have static assertion just like  
>> we
>> have static predicates?
>
> What is the difference between assertion and precondition or invariant?
>

An assertion may applies to multiple things at a time. I like to see an  
assertion as hypothesis (and I prefer the hypothesis to be statically  
checkable :-P ), and it is an hypothesis I may refer to from multiple  
place in a package (although I may like to duplicate it in multiple case),  
not from a single sub‑program.

Also, there is no distinction between private and public predicates, while  
a can put an assertions in a package body, which I will refer to, to  
“prove” the implementation is correct (at least free of runtime errors), I  
can't do the same with a predicate. For hypothesis used in the  
implementation only, public sub‑program predicates are not suitable.

By the way, I don't believe assertions are seen as a deprecated feature,  
and that suggest from many one's eyes, it is indeed different and can't be  
replaced by the actual predicates.

-- 
“Syntactic sugar causes cancer of the semi-colons.” [1]
“Structured Programming supports the law of the excluded muddle.” [1]
[1]: Epigrams on Programming — Alan J. — P. Yale University


  reply	other threads:[~2013-07-23 18:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-23 18:07 What about a Static_Assertion? Yannick Duchêne (Hibou57)
2013-07-23 18:43 ` Dmitry A. Kazakov
2013-07-23 18:57   ` Yannick Duchêne (Hibou57) [this message]
2013-07-23 20:13     ` Dmitry A. Kazakov
2013-07-23 21:46 ` Georg Bauhaus
replies disabled

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