I’ve thought about this proposal a bit more, and I am afraid it’s quite incomplete.
Syntax is debated to no end in every language so being able to settle on the syntax is already something; however there are potentially many other issues to resolve.
For example: the examples only show constants being passed around, but what about expressions? C++ non-type template parameters matterred because you could use expressions from the get go (even if it was quite barebone), so at least I would expect to have a plan on how to deal with expressions even if they are not introduced immediately. Backward compatibility is for life…
Another unresolved question is how to deal with usize and isize. There are two possibilities:
- Use a “virtual machine” based on the target for which the code is emitted
- Use symbolic reasoning (so
usize::max - 1 is non-reducible and different from 4294967294 even on 32-bits platforms)
It’s possible to limit the RFC to non-target dependent code for now; it’ll require being careful with floating points (probably we’ll want strict IEEE compliance).
A strategy to deal with underflow/overflow in compile-time evaluation need be defined. If the value is necessary at compile-time then it should probably be a hard-error, however there might be impacts on potential evolutions later.
That’s all I could think about in the last day or so; but I suspect there are other issues I did not think off…