Request for Comment assert(__ctfe)

Timon Gehr timon.gehr at gmx.ch
Sun Apr 5 20:42:55 UTC 2020


On 05.04.20 22:39, Stefan Koch wrote:
> 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.

Great, thanks! :)


More information about the Digitalmars-d mailing list