Request for Comment assert(__ctfe)

Stefan Koch uplink.coder at googlemail.com
Sun Apr 5 20:39:26 UTC 2020


On Sunday, 5 April 2020 at 20:31:15 UTC, Timon Gehr wrote:
> On 05.04.20 14:11, Stefan Koch wrote:
>> [...]
>
> Make sure it works with `in` contracts:
>
> string generateMixin(string[] params)in{
>     assert(__ctfe);
> }do{
>     .... more code ....
> }
>
> (The plain assertion slightly hurts my eyes, because if it 
> fails, that failure would be attributable to the GenerateMixin 
> function, whereas with the `in` contract it is clear that the 
> caller is at fault.)

Oh good idea.
I don't use contracts myself but that's easy to add.


More information about the Digitalmars-d mailing list