On Wed, Jul 10, 2013 at 03:05:25PM +0200, Don wrote: > On Monday, 8 July 2013 at 20:46:35 UTC, H. S. Teoh wrote: > >On Mon, Jul 08, 2013 at 09:47:46PM +0200, Peter Alexander wrote: [...] > >>Maybe the compiler could just spew out every possible error for > >>every instantiation, and expect the user to grep, but that's not > >>going to be a pleasant experience. > > The compiler could join all the constraints and then simplify it to > create the error message. (eg by creating a Binary Decision Diagram > (BDD)) > > eg given constraints: > > if ( A && B && C ) > if ( (A && D) || ( A && E && F) ) > if ( E && G ) > > Suppose A is true but the conditions fail. The compiler could then > write that no templates match because ( B || D || E ) is false. [...]
Hmm, looking at BDD's again, it appears that the simplification process may not be quite so simple. Depending on the ordering of constraints, you may end up with a BDD of exponential length. The bad thing is that finding the best ordering is NP-hard. There are heuristic algorithms that work well for "normal" cases, though, so hopefully this won't be *too* nasty to implement. T -- Let's not fight disease by killing the patient. -- Sean 'Shaleh' Perry