Re: Showing a user specified error message when no overloads match

2014-07-29 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jul 29, 2014 at 11:30:01PM +, Vlad Levenfeld via Digitalmars-d-learn wrote: > On Tuesday, 29 July 2014 at 15:47:08 UTC, H. S. Teoh via Digitalmars-d-learn > wrote: > >Maybe we should file an enhancement bug to improve error reporting > >for opDispatch. > > I found this https://issues.

Re: Showing a user specified error message when no overloads match

2014-07-29 Thread Vlad Levenfeld via Digitalmars-d-learn
On Tuesday, 29 July 2014 at 15:47:08 UTC, H. S. Teoh via Digitalmars-d-learn wrote: Maybe we should file an enhancement bug to improve error reporting for opDispatch. I found this https://issues.dlang.org/show_bug.cgi?id=8387 and cast a vote for it. I've cast a few votes in the bugtracker, do

Re: Showing a user specified error message when no overloads match

2014-07-29 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jul 29, 2014 at 06:57:00PM +0200, Artur Skawina via Digitalmars-d-learn wrote: > On 07/29/14 17:45, H. S. Teoh via Digitalmars-d-learn wrote: > > You're right, opDispatch behaves like SFINAE. I've had trouble > > debugging it before, because when it works, it works very well, but > > when

Re: Showing a user specified error message when no overloads match

2014-07-29 Thread Artur Skawina via Digitalmars-d-learn
On 07/29/14 17:45, H. S. Teoh via Digitalmars-d-learn wrote: > You're right, opDispatch behaves like SFINAE. I've had trouble debugging > it before, because when it works, it works very well, but when you > accidentally make a typo, it just "disappears" -- you get an error that > the property is mi

Re: Showing a user specified error message when no overloads match

2014-07-29 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, Jul 29, 2014 at 03:34:22AM +, Vlad Levenfeld via Digitalmars-d-learn wrote: > opDispatch behaves as though it has SFINAE. When something fails in > the definition (like I am having now, some of the symbols I used in it > hadn't been imported) there won't ever be an error message, I jus

Re: Showing a user specified error message when no overloads match

2014-07-28 Thread Vlad Levenfeld via Digitalmars-d-learn
opDispatch behaves as though it has SFINAE. When something fails in the definition (like I am having now, some of the symbols I used in it hadn't been imported) there won't ever be an error message, I just get "Error: no property 'bar' for type 'Foo'" In one case I had to use static ifs and pr

Re: Showing a user specified error message when no overloads match

2014-07-27 Thread monarch_dodra via Digitalmars-d-learn
On Sunday, 27 July 2014 at 08:40:42 UTC, Marc Schütz wrote: On Sunday, 27 July 2014 at 00:43:40 UTC, H. S. Teoh via Digitalmars-d-learn wrote: On Sat, Jul 26, 2014 at 05:14:44PM +, via Digitalmars-d-learn wrote: Hmmm... thinking about it, is this possible? 1. Remove the constraints to matc

Re: Showing a user specified error message when no overloads match

2014-07-27 Thread via Digitalmars-d-learn
On Sunday, 27 July 2014 at 00:43:40 UTC, H. S. Teoh via Digitalmars-d-learn wrote: On Sat, Jul 26, 2014 at 05:14:44PM +, via Digitalmars-d-learn wrote: Hmmm... thinking about it, is this possible? 1. Remove the constraints to match anything. 2. Inside the template, have some construct that

Re: Showing a user specified error message when no overloads match

2014-07-26 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Jul 26, 2014 at 05:14:44PM +, via Digitalmars-d-learn wrote: > Hmmm... thinking about it, is this possible? > > 1. Remove the constraints to match anything. > 2. Inside the template, have some construct that enumerates all possible > overloads and UFCS functions that are visible at the

Re: Showing a user specified error message when no overloads match

2014-07-26 Thread via Digitalmars-d-learn
Hmmm... thinking about it, is this possible? 1. Remove the constraints to match anything. 2. Inside the template, have some construct that enumerates all possible overloads and UFCS functions that are visible at the point of instantiation. 3. If this set contains only the current template, use

Re: Showing a user specified error message when no overloads match

2014-07-26 Thread Trass3r via Digitalmars-d-learn
Yeah that's the price we pay for the simplicity. Also most constraints directly or indirectly consist of a complex boolean expressions and you don't get any hint which part failed and why.

Showing a user specified error message when no overloads match

2014-07-25 Thread via Digitalmars-d-learn
I have a template function with a particular constraint (in this case [1]). When this constraint doesn't match, I want to give the user a suggestion what to do instead. The only way I know of to do this currently is to relax the template constraints, and adding a `static assert`. However, if