Date: Wed, 7 Aug 2019 10:14:23 +1000
On Wed, Aug 7, 2019 at 2:29 AM Tony V E <tvaneerd_at_[hidden]> wrote:
>
>
> Why is prolouge/epilogue a property of the function, instead of where it
> is called from?
>
> ie
>
> prolouge precond(...expr...);
> epilogue postcond(...expr...);
>
> f() precond(x > 0) postcond(z < 0);
>
> vs
>
> void cond(...expr...);
>
> f() pre: cond(x > 0), post: cond(z < 0);
>
> Is prologue/epilogue an *intrinsic* property of the function it is tagged
> to, or an *extrinsic* property of where it is to be used?
> I think it is extrinsic.
>
I'm not sure I know the difference between an intrinsic property and an
extrinsic property, but two points:
1. Given your function cond I can write two one-line functions:
prologue void inline precond(bool condition) { cond(condition); }
epilogue void inline postcond(bool condition) { cond(condition); }
To get the same functionality.
The reverse is not so. Given two distinct functions precond and postcond,
I can not write a single cond function that wraps them.
You may want to do different things in a precond and postcond function
(including, say, putting in the error message "precondition violation" or
"postcondition violation" respectively)
2. We may want to provide distinct functionality to prologue functions and
epilogue functions later. For example, I could imagine a future extension
that allows access to the return value within epilogue function definitions
but not within prologue function definitions.
On Tue, Aug 6, 2019 at 4:19 AM Andrew Tomazos via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
>> Please find attached DRAFT 1 of:
>>
>> Proposal of Contract Primitives
>>
>> Feedback appreciated.
>> -Andrew.
>>
>> --
>> Std-Proposals mailing list
>> Std-Proposals_at_[hidden]
>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>>
>
>
> --
> Be seeing you,
> Tony
>
>
>
> Why is prolouge/epilogue a property of the function, instead of where it
> is called from?
>
> ie
>
> prolouge precond(...expr...);
> epilogue postcond(...expr...);
>
> f() precond(x > 0) postcond(z < 0);
>
> vs
>
> void cond(...expr...);
>
> f() pre: cond(x > 0), post: cond(z < 0);
>
> Is prologue/epilogue an *intrinsic* property of the function it is tagged
> to, or an *extrinsic* property of where it is to be used?
> I think it is extrinsic.
>
I'm not sure I know the difference between an intrinsic property and an
extrinsic property, but two points:
1. Given your function cond I can write two one-line functions:
prologue void inline precond(bool condition) { cond(condition); }
epilogue void inline postcond(bool condition) { cond(condition); }
To get the same functionality.
The reverse is not so. Given two distinct functions precond and postcond,
I can not write a single cond function that wraps them.
You may want to do different things in a precond and postcond function
(including, say, putting in the error message "precondition violation" or
"postcondition violation" respectively)
2. We may want to provide distinct functionality to prologue functions and
epilogue functions later. For example, I could imagine a future extension
that allows access to the return value within epilogue function definitions
but not within prologue function definitions.
On Tue, Aug 6, 2019 at 4:19 AM Andrew Tomazos via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
>> Please find attached DRAFT 1 of:
>>
>> Proposal of Contract Primitives
>>
>> Feedback appreciated.
>> -Andrew.
>>
>> --
>> Std-Proposals mailing list
>> Std-Proposals_at_[hidden]
>> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>>
>
>
> --
> Be seeing you,
> Tony
>
Received on 2019-08-06 19:16:36