Expressing range constraints in CNF form

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 11 12:43:18 PDT 2017


On 6/11/2017 8:25 AM, Andrei Alexandrescu wrote:
> Ostensibly the function is trivial:
> 
> bool msg(string) { return true; }
> 
> It doesn't change the semantics. The compiler would recognize it as an intrinsic 
> and would print the message if the clause to its left has failed.

There was a proposal a while back to enable CTFE to print messages, which is 
probably a better solution. msg() could be something along the lines of:

     bool msg(string) { __ctfeprint(string); return true; }

which would involve considerably less compiler magic. Furthermore, `msg` could 
be a local private function, which would avoid "but I'm already using `msg`" 
problems.


More information about the Digitalmars-d mailing list