On 4/25/16 6:14 PM, H. S. Teoh via Digitalmars-d wrote:
On Mon, Apr 25, 2016 at 05:20:08PM -0400, Steven Schveighoffer via
Digitalmars-d wrote:
On 4/25/16 1:52 PM, Andrei Alexandrescu wrote:
It's been long asked in our community that failing template
constraints issue better error messages.
On 26.04.2016 13:26, Marc Schütz wrote:
Currently, there is no boolean short-cut evaluation in template
constraints, see:
bool foo()() {
pragma(msg, "foo");
return true;
}
bool bar()() {
pragma(msg, "bar");
return true;
}
void
On Tuesday, 26 April 2016 at 15:56:55 UTC, Andrei Alexandrescu
wrote:
On 04/26/2016 11:35 AM, Meta wrote:
The nice part about 1 is that every constraint gets it for
free.
Only if in CNF, otherwise needs changed. -- Andrei
True, but I bet the majority of template constraints are in this
On 04/26/2016 11:35 AM, Meta wrote:
The nice part about 1 is that every constraint gets it for free.
Only if in CNF, otherwise needs changed. -- Andrei
On Monday, 25 April 2016 at 17:52:58 UTC, Andrei Alexandrescu
wrote:
Idea #2: Allow custom error messages
The basic idea here is to define pragma(err, "message") as an
expression that formats "message" as an error and returns
false. Then we can write:
R find(R, E)(R range, E elem)
if
On Monday, 25 April 2016 at 17:52:58 UTC, Andrei Alexandrescu
wrote:
It's been long asked in our community that failing template
constraints issue better error messages. Consider:
[...]
I still prefer static inheritance. Having said that, I like the
pragma(err) thing in the template
https://issues.dlang.org/show_bug.cgi?id=9626 ?
On Monday, 25 April 2016 at 17:52:58 UTC, Andrei Alexandrescu
wrote:
Idea #1: Detect and use CNF, print which clause failed
I prefer this one, because it should work without modifying
library or user code.
Idea #2: Allow custom error messages
The basic idea here is to define
On Mon, Apr 25, 2016 at 05:20:08PM -0400, Steven Schveighoffer via
Digitalmars-d wrote:
> On 4/25/16 1:52 PM, Andrei Alexandrescu wrote:
> >It's been long asked in our community that failing template
> >constraints issue better error messages. Consider:
>
> I like the first option. However, I
On Monday, 25 April 2016 at 17:52:58 UTC, Andrei Alexandrescu
wrote:
Idea #1: Detect and use CNF, print which clause failed
CNF (https://en.wikipedia.org/wiki/Conjunctive_normal_form) is
a formula shape in Boolean logic that groups clauses into a
top-level conjunction.
The compiler
On 4/25/16 1:52 PM, Andrei Alexandrescu wrote:
It's been long asked in our community that failing template constraints
issue better error messages. Consider:
I like the first option. However, I think it should be deeper than that.
Sometimes you have code that you are sure matches one of the
On 04/25/2016 04:50 PM, Sebastiaan Koppe wrote:
What about overloaded functions with complex constraints? How would the
errors look when none of the overloaded constraints fully match?
Print reason for each. -- Andrei
On Monday, 25 April 2016 at 17:52:58 UTC, Andrei Alexandrescu
wrote:
Destroy!
Andrei
What about overloaded functions with complex constraints? How
would the errors look when none of the overloaded constraints
fully match?
auto fun(T)(T t) if (hasWheels!T && canFly!T) {}
auto fun(T)(T t)
On 04/25/2016 02:17 PM, Daniel N wrote:
Currently when the compiler is in "__traits(compiles" or "is(typeof"
mode, it simply gags all errors, if it instead would save them to a side
buffer. Later the entire side-buffer could be dumped after a template
constraint totally failed. If a constraint
On Monday, 25 April 2016 at 17:52:58 UTC, Andrei Alexandrescu
wrote:
It's been long asked in our community that failing template
constraints issue better error messages. Consider:
This program uses no constraints. Attempting to compile yields:
/d240/f632.d(3): Error: no property 'empty' for
On Monday, 25 April 2016 at 17:52:58 UTC, Andrei Alexandrescu
wrote:
/d935/f781.d(16): Error: template f781.find cannot deduce
function from argument types !()(NotARange, int), candidates
are:
/d935/f781.d(3): f781.find(R, E)(R range, E elem) constraint
failed: isInputRange!NotARange
This
16 matches
Mail list logo