Identifier (...) is too long by X characters

Tom S h3r3tic at remove.mat.uni.torun.pl
Mon Jul 10 09:47:13 PDT 2006


Sean Kelly wrote:
> Tom S wrote:
>> Sean Kelly wrote:
>>> I don't know.  To do so would be like allowing:
>>>
>>> struct S
>>> {
>>>     S val;
>>> }
>>
>> Umm... not quite. In your case it's just a plain nested, recursive 
>> struct which is obviously impossible. In my case:
>>
>> struct Foo(T) {
>>     Foo!(Foo!(T)) rec()() {
>>         Foo!(Foo!(T)) res;
>>         return res;
>>     }
>> }
>>
>> When the function template is instantiated, one more nesting level is 
>> 'added' and a non-recurring struct is returned.
> 
> Oops, you're right.  I should have looked at the example more closely.

Ah, you haven't noticed the second pair of parentheses after 'rec' ?


> Yeah.  I think the problem in D is that all template members are 
> explicitly instantiated together instead of on an as-needed basis.  But 
> as rec() is itself a template function I wouldn't have expected this 
> behavior.  I agree that this should be changed, assuming it's possible 
> to do so without entirely changing the way templates are instantiated in D.

Thanks for support :)


-- 
Tomasz Stachowiak  /+ a.k.a. h3r3tic +/



More information about the Digitalmars-d-bugs mailing list