Expressing range constraints in CNF form
ketmar via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jun 11 12:47:57 PDT 2017
Walter Bright wrote:
> 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.
that has another problem: there may be overload set, where some overloads
are failed, but one is fitting. using `ctfeprint` will spam user with alot
of non-sensical messages about failed constraints.
More information about the Digitalmars-d
mailing list