www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - alias and template

reply Derek Parnell <derek psych.ward> writes:
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
Nov 24 2005
parent reply Ivan Senji <ivan.senji_REMOVE_ _THIS__gmail.com> writes:
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?
 
Nov 24 2005
parent reply Derek Parnell <derek psych.ward> writes:
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
Nov 25 2005
parent reply Ivan Senji <ivan.senji_REMOVE_ _THIS__gmail.com> writes:
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.
Nov 25 2005
parent reply Don Clugston <dac nospam.com.au> writes:
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.
Nov 25 2005
parent Georg Wrede <georg.wrede nospam.org> writes:
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.
Nov 25 2005