Request for Comment assert(__ctfe)

Stefan Koch uplink.coder at gmail.com
Sun Apr 5 22:12:02 UTC 2020


On Sunday, 5 April 2020 at 20:54:03 UTC, Meta 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.)
>
> We likely get the shorthand version for free as well:
> string generateMixin(...)
> in(__ctfe)
> {
>    ...
> }

No. the in contract was already a pain in the butt.


More information about the Digitalmars-d mailing list