Date: Fri, 26 Sep 2025 10:43:01 +0300
On Fri, 26 Sept 2025 at 10:27, Timur Doumler <cpp_at_[hidden]> wrote:
>
> Hi Ville,
>
> > On 26 Sep 2025, at 10:24, Ville Voutilainen <ville.voutilainen_at_[hidden]> wrote:
> > Link-time selection of contract evaluation semantics doesn't in and of
> > itself require the new technology you seem to be suggesting.
>
> That's interesting. How would you do it without new technology?
You
1) have your compiler compile contract assertions so that the
generated code invokes a function to determine the evaluation
semantic,
and enables/disables a predicate based on that, and decides between
enforce/observe based on that
2) link exactly one definition of that function into your program
3) when you link, you can choose which definition to link, out of
multiple options. Just link in the object file that gives the desired
evaluation semantic.
Piece of cake. No funny mangling approaches, new 'technology', or new
toolchains necessary.
Considering that Iain does actually have a PoC of something like that,
it baffles me that there's some "requires new technology to achieve"
imaginations. I would be remotely interested where such imaginations
come from, because they certainly seem odd and far-fetched to me.
Extend the aforementioned function to call a user-installable hook, or
consult environment variables, or both, and you have run-time
selection
of a contract evaluation semantic.
>
> Hi Ville,
>
> > On 26 Sep 2025, at 10:24, Ville Voutilainen <ville.voutilainen_at_[hidden]> wrote:
> > Link-time selection of contract evaluation semantics doesn't in and of
> > itself require the new technology you seem to be suggesting.
>
> That's interesting. How would you do it without new technology?
You
1) have your compiler compile contract assertions so that the
generated code invokes a function to determine the evaluation
semantic,
and enables/disables a predicate based on that, and decides between
enforce/observe based on that
2) link exactly one definition of that function into your program
3) when you link, you can choose which definition to link, out of
multiple options. Just link in the object file that gives the desired
evaluation semantic.
Piece of cake. No funny mangling approaches, new 'technology', or new
toolchains necessary.
Considering that Iain does actually have a PoC of something like that,
it baffles me that there's some "requires new technology to achieve"
imaginations. I would be remotely interested where such imaginations
come from, because they certainly seem odd and far-fetched to me.
Extend the aforementioned function to call a user-installable hook, or
consult environment variables, or both, and you have run-time
selection
of a contract evaluation semantic.
Received on 2025-09-26 07:43:16