Therefore I would like to start a discussion about options to disable UFCS for some code parts and maybe for other safety features as well.
What do you think about the general idea?
One idea of mine would be to use metafunctions to change the state of the cppfront compiler. e.g.
test: @UFCS_NO namespace = {
// UFCS disabled for the namespace
func: () = {
@UFCS_YES {
// UFCS enabled in this scope.
}
}
}
A different function call operator? E.g. obj.func(! a, b) or func2(! a, b). So the (! operator disables UFCS. ( I used (! because I have no better idea.)
The same technique could be used to disable e.g. bounds checking in loops.
As shown in the comment https://github.com/hsutter/cppfront/pull/904#issuecomment-2150622367 UFCS macro/template can have a real impact on compile times. Also, it improved with the later patches, the error messages a some times quite problematic.
Therefore I would like to start a discussion about options to disable UFCS for some code parts and maybe for other safety features as well.
obj.func(! a, b)
orfunc2(! a, b)
. So the(!
operator disables UFCS. ( I used(!
because I have no better idea.)What are your thoughts?