Thread overview
alias and template
Nov 25, 2005
Derek Parnell
Nov 25, 2005
Ivan Senji
Nov 25, 2005
Derek Parnell
Nov 25, 2005
Ivan Senji
Nov 25, 2005
Don Clugston
Nov 25, 2005
Georg Wrede
November 25, 2005
This will not compile if the commented line is uncommented.

=========================
class Foo(T)
{
    void Bar( Foo!(int) a) {}
}
//alias Foo!(real) dFoo;  // Must be a comment to compile.

========================

Is this a bug or am I missing something?

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
25/11/2005 5:10:07 PM
November 25, 2005
Derek Parnell wrote:
> This will not compile if the commented line is uncommented.
> 
> =========================
> class Foo(T)
> {
>     void Bar( Foo!(int) a) {}

Should be void Bar( .Foo!(int) a) {}

> }
> //alias Foo!(real) dFoo;  // Must be a comment to compile.
> 
> ========================
> 
> Is this a bug or am I missing something?
> 
November 25, 2005
On Fri, 25 Nov 2005 07:30:26 +0100, Ivan Senji wrote:

> Derek Parnell wrote:
>> This will not compile if the commented line is uncommented.
>> 
>> =========================
>> class Foo(T)
>> {
>>     void Bar( Foo!(int) a) {}
> 
> Should be void Bar( .Foo!(int) a) {}
> 
>> }
>> //alias Foo!(real) dFoo;  // Must be a comment to compile.
>> 
>> ========================
>> 
>> Is this a bug or am I missing something?

Thanks. This is not obvious so it should be documented officially. Plus the reason for it too, 'cos I'm still not sure why. But it works now.

-- 
Derek Parnell
Melbourne, Australia
25/11/2005 8:33:51 PM
November 25, 2005
Derek Parnell wrote:
> Thanks. This is not obvious so it should be documented officially. Plus the
> reason for it too, 'cos I'm still not sure why. But it works now.
> 


No it isn't. I don't think that there is anyone who didn't make that mistake. The thing is it is ind the documentation in http://www.digitalmars.com/d/template.html, where it says that templates have their own scope + in that recursive templates example.
November 25, 2005
Ivan Senji wrote:
> Derek Parnell wrote:
> 
>> Thanks. This is not obvious so it should be documented officially. Plus the
>> reason for it too, 'cos I'm still not sure why. But it works now.
>>
> 
> 
> No it isn't. I don't think that there is anyone who didn't make that mistake. The thing is it is ind the documentation in http://www.digitalmars.com/d/template.html, where it says that templates have their own scope + in that recursive templates example.

and the odd thing is, it doesn't seem to be necessary for that example!
At least, in DMD 0.138, it worked if you left out the dot.
Seems to be necessary again in DMD 0.140, where the behaviour is much more predictable.
November 25, 2005
Don Clugston wrote:
> and the odd thing is, it doesn't seem to be necessary for that
> example! At least, in DMD 0.138, it worked if you left out the dot. Seems to be necessary again in DMD 0.140, where the behaviour is much
>  more predictable.

Between .138 and .140, I'd take whatever .140 does as the Canonical out of those two.