Date: Thu, 1 Aug 2019 17:18:21 +0000
Okay, I see what you mean. The contract proposal covers what I'm proposing
here. I hope it goes well. Let's disregard the function argument
constraints because I really didn't even go over the C++ Contract proposal
completely.
Thanks,
Jim Smith
On Thu, Aug 1, 2019 at 5:02 PM Tae Lim Kook via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> On Thursday, August 1, 2019 12:59 PM, Jim Smith via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
> > Functions sometimes check the sanity of the data passed to them. This
> could require a number of checks and error handing. For example:
> >
> > Foo& Foo::operator=(const Foo& obj)
> > {
> > if(&obj == this)
> > return *this
> > ...
> > }
> >
> > A more convenient way of handling this situation would be to allow
> constraints on arguments and let the compiler check or add code to handle
> the condition.
> >
> > For example:
> >
> > Foo& Foo::operator=(const Foo& obj { &obj != this } ) <-- Argument
> constraint in braces
> > {
> > ...
> > }
>
> How is this different from the contracts proposal? Would you be able to
> have overloads based on this?
>
> -- T
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> http://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
here. I hope it goes well. Let's disregard the function argument
constraints because I really didn't even go over the C++ Contract proposal
completely.
Thanks,
Jim Smith
On Thu, Aug 1, 2019 at 5:02 PM Tae Lim Kook via Std-Proposals <
std-proposals_at_[hidden]> wrote:
> On Thursday, August 1, 2019 12:59 PM, Jim Smith via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
> > Functions sometimes check the sanity of the data passed to them. This
> could require a number of checks and error handing. For example:
> >
> > Foo& Foo::operator=(const Foo& obj)
> > {
> > if(&obj == this)
> > return *this
> > ...
> > }
> >
> > A more convenient way of handling this situation would be to allow
> constraints on arguments and let the compiler check or add code to handle
> the condition.
> >
> > For example:
> >
> > Foo& Foo::operator=(const Foo& obj { &obj != this } ) <-- Argument
> constraint in braces
> > {
> > ...
> > }
>
> How is this different from the contracts proposal? Would you be able to
> have overloads based on this?
>
> -- T
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> http://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
Received on 2019-08-01 12:20:31