Question about eponymous template trick

2014-11-03 Thread Uranuz via Digitalmars-d-learn
I have an example of code like this: template Node(String) { struct Node {} struct Name {} struct Attr {} } void main() { alias MyNode = Node!(string).Node; alias MyName = Node!(string).Name; alias MyAttr = Node!(string).Attr; }

Re: Question about eponymous template trick

2014-11-03 Thread MrSmith via Digitalmars-d-learn
On Monday, 3 November 2014 at 14:07:55 UTC, Uranuz wrote: I have an example of code like this: template Node(String) { struct Node {} struct Name {} struct Attr {} } void main() { alias MyNode = Node!(string).Node; alias MyName =

Re: Question about eponymous template trick

2014-11-03 Thread Uranuz via Digitalmars-d-learn
Looks like compiler looks for Node, Name and Attr in Node struct, because of eponymous thing. I understand it but I want to know if it is documented behaviour or not. Could anybody clear what happens with eponymous stuff and why I can't get acces to *other* declarations inside eponymous

Re: Question about eponymous template trick

2014-11-03 Thread Ali Çehreli via Digitalmars-d-learn
On 11/03/2014 06:36 AM, Uranuz wrote: Looks like compiler looks for Node, Name and Attr in Node struct, because of eponymous thing. I understand it but I want to know if it is documented behaviour or not. Could anybody clear what happens with eponymous stuff and why I can't get acces to

Re: Question about eponymous template trick

2014-11-03 Thread Uranuz via Digitalmars-d-learn
I think it's the intended behavior. I think documentation is outdated. Ali Thanks. So I will modify my programme to workaround this.

Re: Question about eponymous template trick

2014-11-03 Thread Uranuz via Digitalmars-d-learn
Also I failed to find any documentation about eponymous stuff in language reference. As far as I remember it was here but now looks like it is missing.

Re: Question about eponymous template trick

2014-11-03 Thread Sean Kelly via Digitalmars-d-learn
On Monday, 3 November 2014 at 14:58:03 UTC, Ali Çehreli wrote: I think it's the intended behavior. I think documentation is outdated. Both forms should really work though. I had always thought that the short form was simply possible if the names matched.

Re: Question about eponymous template trick

2014-11-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/3/14 9:07 AM, Uranuz wrote: I have an example of code like this: template Node(String) { struct Node {} struct Name {} struct Attr {} } void main() { alias MyNode = Node!(string).Node; alias MyName = Node!(string).Name; alias MyAttr = Node!(string).Attr; }