Request for Comment assert(__ctfe)

Dennis dkorpel at gmail.com
Thu Apr 9 10:00:14 UTC 2020


On Thursday, 9 April 2020 at 09:30:14 UTC, Timon Gehr wrote:
> On 08.04.20 12:27, Dennis wrote:
>> What now, another hack? Or should we finally think of 
>> something to make __ctfe work with `static if` / `static 
>> assert` proper?
>
> It's obvious how to make that work, but is it really worth the 
> effort and compile time overhead? You'd have to perform 
> semantic analysis twice for each function.

That could be a good POC implementation to start with, from there 
we can see how far it can be optimized.

However, what I meant with that statement was not that we 
literally should support `static if (__ctfe)`, just some way of 
actually statically recognizing ctfe-only code.

pragma(ctfe) looks like a promising candidate to me: 
https://github.com/dlang/dmd/pull/11014



More information about the Digitalmars-d mailing list