Re: An idea to improve eponymous templates

2012-04-12 Thread Daniel Murphy
kenji hara k.hara...@gmail.com wrote in message news:mailman.1646.1334209001.4860.digitalmar...@puremagic.com... It conflicts with $B!I(Balias this$B!I(B syntax. template Inherits(T) { T value; alias T Inherits; // (1) Inherits!int == int alias T this; // (2) declares alias

Re: An idea to improve eponymous templates

2012-04-12 Thread Jacob Carlborg
On 2012-04-12 11:21, Daniel Murphy wrote: Doesn't it need to be explicitly marked as a 'mixin template' for it to be mixed in? No, I don't think that is forced. -- /Jacob Carlborg

Re: An idea to improve eponymous templates

2012-04-12 Thread kenji hara
No. Current implementation doesn't enforce it. Kenji Hara 2012年4月12日18:21 Daniel Murphy yebbl...@nospamgmail.com: kenji hara k.hara...@gmail.com wrote in message news:mailman.1646.1334209001.4860.digitalmar...@puremagic.com... It conflicts with ”alias this” syntax. template Inherits(T) {

Re: An idea to improve eponymous templates

2012-04-12 Thread Daniel Murphy
Jacob Carlborg d...@me.com wrote in message news:jm66st$2d3f$1...@digitalmars.com... On 2012-04-12 11:21, Daniel Murphy wrote: Doesn't it need to be explicitly marked as a 'mixin template' for it to be mixed in? No, I don't think that is forced. -- /Jacob Carlborg Hmm. I guess the

Re: An idea to improve eponymous templates

2012-04-12 Thread Don Clugston
On 12/04/12 04:21, Reid Levenick wrote: Firstly, I had no idea where suggestions should go, and I saw a few others here and thus here I am. I was writing some code that depended heavily on my own eponymous templates, and decided to change the names of some of them to make them more

Re: An idea to improve eponymous templates

2012-04-12 Thread H. S. Teoh
On Thu, Apr 12, 2012 at 07:31:11PM +1000, Daniel Murphy wrote: Jacob Carlborg d...@me.com wrote in message news:jm66st$2d3f$1...@digitalmars.com... On 2012-04-12 11:21, Daniel Murphy wrote: Doesn't it need to be explicitly marked as a 'mixin template' for it to be mixed in? No,

Re: An idea to improve eponymous templates

2012-04-12 Thread Mehrdad
+1 for This bearophile wrote in message news:bcqvpvgjswwdgsfxs...@forum.dlang.org... Reid Levenick: So, my idea is that the 'this' keyword could be used in templates as a shortcut for eponymous templates, allowing code like this template anEponymousTemplate( size_t whatever ) { enum this

Re: An idea to improve eponymous templates

2012-04-12 Thread Mehrdad
+1 for This bearophile wrote in message news:bcqvpvgjswwdgsfxs...@forum.dlang.org... Reid Levenick: So, my idea is that the 'this' keyword could be used in templates as a shortcut for eponymous templates, allowing code like this template anEponymousTemplate( size_t whatever ) { enum this

Re: An idea to improve eponymous templates

2012-04-12 Thread Timon Gehr
On 04/12/2012 04:21 AM, Reid Levenick wrote: Firstly, I had no idea where suggestions should go, and I saw a few others here and thus here I am. I was writing some code that depended heavily on my own eponymous templates, and decided to change the names of some of them to make them more

Re: An idea to improve eponymous templates

2012-04-12 Thread Steven Schveighoffer
On Thu, 12 Apr 2012 14:04:44 -0400, Timon Gehr timon.g...@gmx.ch wrote: The general idea is useful, but there are issues. 'this' is the wrong keyword for the job. A class or struct instance is very different from a template instance and the proposed usage would clash with existing and

Re: An idea to improve eponymous templates

2012-04-12 Thread H. S. Teoh
On Thu, Apr 12, 2012 at 08:04:44PM +0200, Timon Gehr wrote: [...] The general idea is useful, but there are issues. 'this' is the wrong keyword for the job. A class or struct instance is very different from a template instance and the proposed usage would clash with existing and useful ones.

Re: An idea to improve eponymous templates

2012-04-12 Thread Timon Gehr
On 04/12/2012 08:19 PM, Steven Schveighoffer wrote: On Thu, 12 Apr 2012 14:04:44 -0400, Timon Gehr timon.g...@gmx.ch wrote: The general idea is useful, but there are issues. 'this' is the wrong keyword for the job. A class or struct instance is very different from a template instance and the

An idea to improve eponymous templates

2012-04-11 Thread Reid Levenick
Firstly, I had no idea where suggestions should go, and I saw a few others here and thus here I am. I was writing some code that depended heavily on my own eponymous templates, and decided to change the names of some of them to make them more self-documenting. However, after changing the

Re: An idea to improve eponymous templates

2012-04-11 Thread H. S. Teoh
On Thu, Apr 12, 2012 at 04:21:45AM +0200, Reid Levenick wrote: Firstly, I had no idea where suggestions should go, and I saw a few others here and thus here I am. AFAIK this is as good a place as any other. I was writing some code that depended heavily on my own eponymous templates, and

Re: An idea to improve eponymous templates

2012-04-11 Thread bearophile
Reid Levenick: So, my idea is that the 'this' keyword could be used in templates as a shortcut for eponymous templates, allowing code like this template anEponymousTemplate( size_t whatever ) { enum this = whatever * 2; } Other This (with upper case)? Bye, bearophile

Re: An idea to improve eponymous templates

2012-04-11 Thread Andrei Alexandrescu
On 4/11/12 9:21 PM, Reid Levenick wrote: So, my idea is that the 'this' keyword could be used in templates as a shortcut for eponymous templates, allowing code like this template anEponymousTemplate( size_t whatever ) { enum this = whatever * 2; } template anotherOne( T ) { static if( is( T ==

Re: An idea to improve eponymous templates

2012-04-11 Thread Reid Levenick
On Thursday, 12 April 2012 at 04:28:01 UTC, Nathan M. Swan wrote: I like the idea. To get rid of any confusion with keywords, name-mangling, or classes, I suggest having this being syntactic sugar for the name of the template. I expressed it badly at the time, but that is exactly what I

Re: An idea to improve eponymous templates

2012-04-11 Thread Nathan M. Swan
On Thursday, 12 April 2012 at 02:21:46 UTC, Reid Levenick wrote: Firstly, I had no idea where suggestions should go, and I saw a few others here and thus here I am. I was writing some code that depended heavily on my own eponymous templates, and decided to change the names of some of them to

Re: An idea to improve eponymous templates

2012-04-11 Thread Denis Shelomovskij
12.04.2012 6:21, Reid Levenick написал: Firstly, I had no idea where suggestions should go, and I saw a few others here and thus here I am. I was writing some code that depended heavily on my own eponymous templates, and decided to change the names of some of them to make them more

Re: An idea to improve eponymous templates

2012-04-11 Thread kenji hara
It conflicts with ”alias this” syntax. template Inherits(T) { T value; alias T Inherits; // (1) Inherits!int == int alias T this; // (2) declares alias this! } struct S { mixin Inherits!int; // (1) invalid or (2) mixing alias this declaration? } Kenji Hara 2012年4月12日11:21 Reid