I still do not understand. I would imagine something like: foo <precondition: #invariant> <postcondition: #invariant> self bar But, all in all, what are we using pragmas here? I can always do: self assert: [ ⦠] description: ⦠Maybe we should specific a method called contractInvariant that is always executed before and after. Using Reflectivity. Alexandre
On Feb 26, 2016, at 11:50 AM, Alain Rastoul <alf.mmm.cat@gmail.com> wrote:
On 26/02/2016 11:26, Alexandre Bergel wrote:
Hi Alain,
Having contract is a valuable effort!
On Feb 26, 2016, at 11:12 AM, Alain Rastoul <alf.mmm.cat@gmail.com> wrote:
<contract: #ensured appliedTo: #( #add: )>
What does that mean? <contract: #ensured appliedTo: #( #add: )>
Alexandre
Hi Alexandre,
a method with a pragma <contract: #ensured appliedTo: #( #add: ) > means it is a check that must be ensured by (enforced by) the method to which it applies (here add:). The add: method of the object *must* verify this check, when the check is executed, it must return true.
May be the terms I've choosed are confusing at first, but it was voluntary, preCondition, postCondition are too much program execution oriented IMHO, not enough assertive .
btw it is easy to change: one could say here: <contract: postcondition on: #( #add: )>
may be better ?
or may be better to support both ... :)
Alain
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.