Template constraints error messages using cputs()

Don nospam at nospam.com
Sun Aug 8 06:41:30 PDT 2010


bearophile wrote:
> BCS:
>> One solution to this issue would be to have an unconstrained temple that 
>> contains nothing but prgam(msg,"...") inside static ifs. That way failing 
>> the constraint produces a nice message and then, because the template has 
>> nothing it it, using it for almost anything will generate an error and block 
>> compilation.
> 
> I will try this solution, thank you. But cputs will be useful regardless. You can usually find a twisted way to solve most problems, but keeping pragms(msg) in D is not good, it's a temporary solution at best. One of the 'temporary solutions' in D that risks to stick around forever, I fear.
> 
> Bye,
> bearophile

pragma(msg) was NOT intended for metaprogramming. It's an accident that 
it works at all for the things people are using it for.


More information about the Digitalmars-d mailing list