forward references... again?

Regan Heath regan at netmail.co.nz
Tue Sep 27 03:43:50 PDT 2011


On Tue, 27 Sep 2011 11:05:12 +0100, Mehrdad <wfunction at hotmail.com> wrote:

> On 9/27/2011 2:37 AM, Regan Heath wrote:
>> On Mon, 26 Sep 2011 19:07:59 +0100, Mehrdad <wfunction at hotmail.com>  
>> wrote:
>>
>>> Nah, that's not the issue. Originally it was a different name, it just  
>>> so happened that I didn't notice this in the simplification.
>>>
>>> However, I DID find the problem -- it's because the function is  
>>> recursive. :(
>>> What I _meant_ to say was a.get(args) + b.get(args), but I said (a +  
>>> b).get(args).  So it was pretty much calling itself.
>>
>> So.. bug report for the bad error message then?
>>
> I... guess? But I'm not sure how to improve it. Something along the  
> lines of "foo is currently being defined" might be clearer, but then  
> again it's not like I didn't figure that out myself -- it's just that I  
> thought it's for a different instantiation of the template.

Hmm.. I don't really know either, trying to untangle templates does my  
head in.  Would it have helped if the error mentioned the "inferred return  
type" i.e.
   "Error: forward reference to inferred return type <file>.Sum!(Test,Test)  
of function call this.a.opAdd(this.b).get(_param_0)"

the next error does mention the template it was instantiating, e.g.
   "Error: template instance <file>.Sum!(Test,Test).Sum.get!(double) error  
instantiating"

so, provided you noticed that the inferred return type matched the  
template you would expect that to be the forward reference/problem..

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Digitalmars-d mailing list