zygoloid wrote:

> > the special "the language rules say this is manifestly constant evaluated" 
> > cases that should be able to perform AST mutations, that we need to be 
> > extremely careful to invoke at exactly the right times and in exactly the 
> > right cases and to invoke only once
> 
> Can you expand on the "to invoke only once" bit? As I understand the position 
> of authors of P2996, calls to `define_aggregate` with the same arguments are 
> supposed to be idempotent. Do you see reasons why we wouldn't be able to 
> achieve that, meaning that we need to prevent `define_aggregate` to be called 
> multiple times (with the same arguments) on the language level?

I think it's short-sighted to imagine that will work for the breadth of 
compile-time constructs we'll end up providing. People have already asked for 
things like a consteval function that produces a warning or an error -- is that 
also going to be idempotent? What about consteval facilities that generate 
random numbers, or produce a log file on the build machine? What about a 
consteval utility that generates a new anonymous global? What do you do if you 
*want* each call to your "make a new type" facility to guarantee to produce a 
new, distinct type?

Maybe we can say no to some of those things, but I don't think we'll be able to 
say no to all of them forever. It seems more forward-looking to me to instead 
guarantee that we will evaluate exactly the things we're required to evaluate 
in this new mode, exactly once each.

https://github.com/llvm/llvm-project/pull/115168
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to