digitalmars.D - catchy phrase for this idiom?
- Andrei Alexandrescu (11/11) Mar 12 2009 Hello,
- jq (3/17) Mar 12 2009 Template forwarding?
- Don (2/21) Mar 12 2009 Selfish template?
- Don (2/24) Mar 12 2009 Transparent template?
- Gide Nwawudu (4/15) Mar 12 2009 Reciprocal template declaration?
- Sean Kelly (2/16) Mar 12 2009 Template identity definition?
- Sean Kelly (7/24) Mar 12 2009 Oh, and should this actually be:
- Steven Schveighoffer (5/16) Mar 12 2009 Sounds good.
- Bill Baxter (4/22) Mar 12 2009 eponymous alias?
- Bill Baxter (4/22) Mar 12 2009 eponymous alias?
- BCS (2/20) Mar 12 2009 Template ALIASING -> taliasing or tail-asing
- Ary Borenszweig (2/26) Mar 12 2009 Templing?
- Walter Bright (1/1) Mar 12 2009 name promotion
- Nick Sabalausky (3/9) Mar 12 2009 Unitemplate?
- Nick Sabalausky (6/19) Mar 12 2009 ...Unless you're talking specifically about an alias (as opposed to the
- Jarrett Billingsley (24/33) Mar 12 2009 e
- Denis Koroskin (3/41) Mar 12 2009 Completely agree. That's why I proposed to separate templates and templa...
- Steven Schveighoffer (12/39) Mar 12 2009 How do you do this without the Template Identity syntax?
- Denis Koroskin (16/57) Mar 12 2009 A new 'tempalte' keyword?
- BCS (5/21) Mar 12 2009 That covers my one major concern with the exactly one rule; local values...
- Denis Koroskin (9/28) Mar 12 2009 You could use a tuple or struct for that purpose:
- BCS (4/37) Mar 12 2009 Under some conditions (I never figured out the details) you end up being...
- Denis Koroskin (3/39) Mar 12 2009 These should be stripped by linked, shoudn't they?
- BCS (4/14) Mar 12 2009 That would help some, but they cause problems both that the link level (...
- Jarrett Billingsley (6/9) Mar 12 2009 I'm not suggesting it be removed. I'm suggesting that if you were
- Steven Schveighoffer (6/17) Mar 12 2009 So without requiring the alias how do you rewrite my example? I'm not
- Jarrett Billingsley (15/32) Mar 12 2009 le
- Denis Koroskin (3/43) Mar 12 2009 Sean has proposed (or let out a secret?) that:
- Ary Borenszweig (5/60) Mar 12 2009 But maybe "this" gets confused with "this class' instance" (just the
- Andrei Alexandrescu (9/50) Mar 12 2009 Nice. The problem however is that very, very often I need to store
- Jarrett Billingsley (5/12) Mar 12 2009 That's true.
- Sergey Gromov (2/19) Mar 12 2009 maybe parametrized alias
- Andrei Alexandrescu (4/25) Mar 12 2009 That sounds good but (I'm saying this to all others who focused on
- Sergey Gromov (2/29) Mar 14 2009 template shortcut?
- Christopher Wright (2/21) Mar 12 2009 Eigentemplate.
- BCS (2/4) Mar 12 2009 Doh! :)
- Andrei Alexandrescu (5/27) Mar 12 2009 My heart fell among my other integrated circuits. Looks like a huge
- Bill Baxter (11/39) Mar 12 2009 r.
- Walter Bright (2/3) Mar 12 2009 I can't even pronounce "eponymous". Not too catchy :-)
- Bill Baxter (5/9) Mar 12 2009 R.E.M. thought it was catchy enough to name an album that. :-)
- BCS (2/10) Mar 12 2009 An Eigen value for a matrix M is a vector V sutch that M x V = V (IIRC)
- Bill Baxter (7/17) Mar 12 2009 Close,
- Andrei Alexandrescu (7/21) Mar 13 2009 That's an eigenvector. An eigenvalue is a multiplier alpha such that M x...
- Christopher Wright (2/5) Mar 13 2009 That's pretty specific for a German word meaning 'self'.
- Robert Fraser (3/32) Mar 13 2009 If it's called this, I will have flashbacks to Linear Algebra every time...
- Simen Kjaeraas (4/35) Mar 13 2009 And here I thought that'd be a good thing...
- Kagamin (2/8) Mar 13 2009 verbose templated declaration.
- Nick Sabalausky (3/11) Mar 13 2009 As far as I'm concerned, we've found a winner right here ;)
- Tim M (5/18) Mar 14 2009 What's verbose about a template with a single declaration?
- Kagamin (7/24) Mar 16 2009 Normally you write templated declaration using only one symbol:
Hello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this? Thanks, Andrei
Mar 12 2009
Andrei Alexandrescu Wrote:Hello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this?Template forwarding? Jerry
Mar 12 2009
Andrei Alexandrescu wrote:Hello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this? Thanks, AndreiSelfish template?
Mar 12 2009
Don wrote:Andrei Alexandrescu wrote:Transparent template?Hello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this? Thanks, AndreiSelfish template?
Mar 12 2009
On Thu, 12 Mar 2009 06:33:34 -0700, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Hello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this? Thanks, AndreiReciprocal template declaration? Gide
Mar 12 2009
Andrei Alexandrescu wrote:Hello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this?Template identity definition?
Mar 12 2009
Sean Kelly wrote:Andrei Alexandrescu wrote:Oh, and should this actually be: template Blah(Stuff) { alias ... this; } I thought that was the new syntax.Hello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this?Template identity definition?
Mar 12 2009
On Thu, 12 Mar 2009 11:01:21 -0400, Sean Kelly <sean invisibleduck.org> wrote:Andrei Alexandrescu wrote:Sounds good. I think Template Identity sounds good too. -SteveHello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this?Template identity definition?
Mar 12 2009
eponymous alias? --bb On Fri, Mar 13, 2009 at 12:55 AM, Steven Schveighoffer <schveiguy yahoo.com> wrote:On Thu, 12 Mar 2009 11:01:21 -0400, Sean Kelly <sean invisibleduck.org> wrote:Andrei Alexandrescu wrote:Sounds good. I think Template Identity sounds good too. -SteveHello, =A0I'm looking for a catchy phrase denoting this D idiom: =A0template Blah(Stuff) { =A0 alias ... Blah; } =A0i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. =A0What would be a catchy, descriptive, and memorable phrase for this?Template identity definition?
Mar 12 2009
eponymous alias? --bb On Fri, Mar 13, 2009 at 12:55 AM, Steven Schveighoffer <schveiguy yahoo.com> wrote:On Thu, 12 Mar 2009 11:01:21 -0400, Sean Kelly <sean invisibleduck.org> wrote:Andrei Alexandrescu wrote:Sounds good. I think Template Identity sounds good too. -SteveHello, =A0I'm looking for a catchy phrase denoting this D idiom: =A0template Blah(Stuff) { =A0 alias ... Blah; } =A0i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. =A0What would be a catchy, descriptive, and memorable phrase for this?Template identity definition?
Mar 12 2009
Reply to Andrei,Hello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this? Thanks, AndreiTemplate ALIASING -> taliasing or tail-asing
Mar 12 2009
BCS wrote:Reply to Andrei,Templing?Hello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this? Thanks, AndreiTemplate ALIASING -> taliasing or tail-asing
Mar 12 2009
"Andrei Alexandrescu" <SeeWebsiteForEmail erdani.org> wrote in message news:gpb2vd$18uf$1 digitalmars.com...Hello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; }Unitemplate?
Mar 12 2009
"Nick Sabalausky" <a a.a> wrote in message news:gpbnms$2ba1$1 digitalmars.com..."Andrei Alexandrescu" <SeeWebsiteForEmail erdani.org> wrote in message news:gpb2vd$18uf$1 digitalmars.com......Unless you're talking specifically about an alias (as opposed to the general case of it being an alias or a const char[] or a function or a class, etc), in which case it should just be "alias template" to go along with "function template" and "class template".Hello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; }Unitemplate?
Mar 12 2009
On Thu, Mar 12, 2009 at 9:33 AM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Hello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { =A0 alias ... Blah; } i.e., defining inside a template a symbol of the same name as the templat=eitself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this?...Unnecessary? You know i have to be contrary :P but I have never found a use for multiple declarations inside a template _except_ when it's used as a mixin. Most of the time, I declare exactly one symbol inside the template, and it's always the same name as the template. Having to specify the name of the template over and over inside it is a blatant violation of DRY, easy to mess up (typos, changing the template name etc.) and is hard to diagnose when you do it wrong, since the compiler just has no idea what you're trying to do and you end up with all sorts of confusing errors about voids having no value. Allowing multiple declarations inside templates looks good in the spec, but honestly, I only ever use it for mixins. My mixin templates are also never used as anything other than mixin templates, creating this sort of split between templates and mixins, even though they're represented by the same language structure. Mixins are really more like a limited form of semihygenic AST macro, one which can only expand to declarations and not arbitrary code structures. If templates were limited to a single declaration - and mixins were either changed to a different "type" or replaced outright by macros - I'd be perfectly happy, and there'd be no need for Implicit Template Name Forwarding (do you see what I just did there ;) ).
Mar 12 2009
On Thu, 12 Mar 2009 23:11:49 +0300, Jarrett Billingsley <jarrett.billingsley gmail.com> wrote:On Thu, Mar 12, 2009 at 9:33 AM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Completely agree. That's why I proposed to separate templates and template mixins one from another: http://www.digitalmars.com/d/archives/digitalmars/D/internal_local_template_memebers_78677.html#N78698Hello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this?...Unnecessary? You know i have to be contrary :P but I have never found a use for multiple declarations inside a template _except_ when it's used as a mixin. Most of the time, I declare exactly one symbol inside the template, and it's always the same name as the template. Having to specify the name of the template over and over inside it is a blatant violation of DRY, easy to mess up (typos, changing the template name etc.) and is hard to diagnose when you do it wrong, since the compiler just has no idea what you're trying to do and you end up with all sorts of confusing errors about voids having no value. Allowing multiple declarations inside templates looks good in the spec, but honestly, I only ever use it for mixins. My mixin templates are also never used as anything other than mixin templates, creating this sort of split between templates and mixins, even though they're represented by the same language structure. Mixins are really more like a limited form of semihygenic AST macro, one which can only expand to declarations and not arbitrary code structures. If templates were limited to a single declaration - and mixins were either changed to a different "type" or replaced outright by macros - I'd be perfectly happy, and there'd be no need for Implicit Template Name Forwarding (do you see what I just did there ;) ).
Mar 12 2009
On Thu, 12 Mar 2009 16:11:49 -0400, Jarrett Billingsley wrote:On Thu, Mar 12, 2009 at 9:33 AM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:How do you do this without the Template Identity syntax? (I'm going to start calling it this to promote the term I thought was best ;) tempalte Blah(T) { static if(is(T : int)) alias T Blah; else alias T* Blah; } -SteveHello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this?...Unnecessary? You know i have to be contrary :P but I have never found a use for multiple declarations inside a template _except_ when it's used as a mixin. Most of the time, I declare exactly one symbol inside the template, and it's always the same name as the template. Having to specify the name of the template over and over inside it is a blatant violation of DRY, easy to mess up (typos, changing the template name etc.) and is hard to diagnose when you do it wrong, since the compiler just has no idea what you're trying to do and you end up with all sorts of confusing errors about voids having no value.
Mar 12 2009
On Thu, 12 Mar 2009 23:20:07 +0300, Steven Schveighoffer <schveiguy yahoo.com> wrote:On Thu, 12 Mar 2009 16:11:49 -0400, Jarrett Billingsley wrote:A new 'tempalte' keyword? Back on topic, I don't see anything wrong with this code. It defines exactly one alias. I also think that it should define exactly one /public/ alias: template Blah(T) { private alias Foo!(T).A Tmp1; private alias Bar!(Tmp1!(T)).B Tmp2; static if (Tmp2.C!(T)) { private alias Tmp2.ResultA Tmp3; } else { private alias Tmp2.ResultB Tmp3; } /*public*/ alias Tmp3!(Tmp2!(Tmp1!())).C Blah; } This syntax makes little sense for template mixins, and that's one more reason why I proposed separating them (see my other post nearby).On Thu, Mar 12, 2009 at 9:33 AM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:How do you do this without the Template Identity syntax? (I'm going to start calling it this to promote the term I thought was best ;) tempalte Blah(T) { static if(is(T : int)) alias T Blah; else alias T* Blah; } -SteveHello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this?...Unnecessary? You know i have to be contrary :P but I have never found a use for multiple declarations inside a template _except_ when it's used as a mixin. Most of the time, I declare exactly one symbol inside the template, and it's always the same name as the template. Having to specify the name of the template over and over inside it is a blatant violation of DRY, easy to mess up (typos, changing the template name etc.) and is hard to diagnose when you do it wrong, since the compiler just has no idea what you're trying to do and you end up with all sorts of confusing errors about voids having no value.
Mar 12 2009
Reply to Denis,Back on topic, I don't see anything wrong with this code. It defines exactly one alias. I also think that it should define exactly one /public/ alias: template Blah(T) { private alias Foo!(T).A Tmp1; private alias Bar!(Tmp1!(T)).B Tmp2; static if (Tmp2.C!(T)) { private alias Tmp2.ResultA Tmp3; } else { private alias Tmp2.ResultB Tmp3; } /*public*/ alias Tmp3!(Tmp2!(Tmp1!())).C Blah; }That covers my one major concern with the exactly one rule; local values. OTOH I have used template with many public value as a type of compile time structs. It's an absolute must for anything thing that require data structures like parsing of strings.
Mar 12 2009
On Thu, 12 Mar 2009 23:56:55 +0300, BCS <ao pathlink.com> wrote:Reply to Denis,You could use a tuple or struct for that purpose: template Blah(Stuff) { struct Blah { // code that defines multiple symbols here } }Back on topic, I don't see anything wrong with this code. It defines exactly one alias. I also think that it should define exactly one /public/ alias: template Blah(T) { private alias Foo!(T).A Tmp1; private alias Bar!(Tmp1!(T)).B Tmp2; static if (Tmp2.C!(T)) { private alias Tmp2.ResultA Tmp3; } else { private alias Tmp2.ResultB Tmp3; } /*public*/ alias Tmp3!(Tmp2!(Tmp1!())).C Blah; }That covers my one major concern with the exactly one rule; local values. OTOH I have used template with many public value as a type of compile time structs. It's an absolute must for anything thing that require data structures like parsing of strings.
Mar 12 2009
Reply to Denis,On Thu, 12 Mar 2009 23:56:55 +0300, BCS <ao pathlink.com> wrote:Under some conditions (I never figured out the details) you end up being forced to do that anyway. However in heavy code you can literally get MB of meta data generated for struct that are never actually used for anything.Reply to Denis,You could use a tuple or struct for that purpose: template Blah(Stuff) { struct Blah { // code that defines multiple symbols here } }Back on topic, I don't see anything wrong with this code. It defines exactly one alias. I also think that it should define exactly one /public/ alias: template Blah(T) { private alias Foo!(T).A Tmp1; private alias Bar!(Tmp1!(T)).B Tmp2; static if (Tmp2.C!(T)) { private alias Tmp2.ResultA Tmp3; } else { private alias Tmp2.ResultB Tmp3; } /*public*/ alias Tmp3!(Tmp2!(Tmp1!())).C Blah; }That covers my one major concern with the exactly one rule; local values. OTOH I have used template with many public value as a type of compile time structs. It's an absolute must for anything thing that require data structures like parsing of strings.
Mar 12 2009
On Fri, 13 Mar 2009 00:56:48 +0300, BCS <ao pathlink.com> wrote:Reply to Denis,These should be stripped by linked, shoudn't they? That's a separate issue if linker doesn't do it properly.On Thu, 12 Mar 2009 23:56:55 +0300, BCS <ao pathlink.com> wrote:Under some conditions (I never figured out the details) you end up being forced to do that anyway. However in heavy code you can literally get MB of meta data generated for struct that are never actually used for anything.Reply to Denis,You could use a tuple or struct for that purpose: template Blah(Stuff) { struct Blah { // code that defines multiple symbols here } }Back on topic, I don't see anything wrong with this code. It defines exactly one alias. I also think that it should define exactly one /public/ alias: template Blah(T) { private alias Foo!(T).A Tmp1; private alias Bar!(Tmp1!(T)).B Tmp2; static if (Tmp2.C!(T)) { private alias Tmp2.ResultA Tmp3; } else { private alias Tmp2.ResultB Tmp3; } /*public*/ alias Tmp3!(Tmp2!(Tmp1!())).C Blah; }That covers my one major concern with the exactly one rule; local values. OTOH I have used template with many public value as a type of compile time structs. It's an absolute must for anything thing that require data structures like parsing of strings.
Mar 12 2009
Reply to Denis,On Fri, 13 Mar 2009 00:56:48 +0300, BCS <ao pathlink.com> wrote:That would help some, but they cause problems both that the link level (extra IO) and the the compile time level (I have seen dmd spend *minutes* generating the meta data.Under some conditions (I never figured out the details) you end up being forced to do that anyway. However in heavy code you can literally get MB of meta data generated for struct that are never actually used for anything.These should be stripped by linked, shoudn't they? That's a separate issue if linker doesn't do it properly.
Mar 12 2009
On Thu, Mar 12, 2009 at 4:20 PM, Steven Schveighoffer <schveiguy yahoo.com> wrote:How do you do this without the Template Identity syntax? (I'm going to start calling it this to promote the term I thought was best ;)I'm not suggesting it be removed. I'm suggesting that if you were only able to put one symbol in the template, it would be completely unnecessary. Templates would always resolve to the single symbol that they declare.
Mar 12 2009
On Thu, 12 Mar 2009 16:37:06 -0400, Jarrett Billingsley <jarrett.billingsley gmail.com> wrote:On Thu, Mar 12, 2009 at 4:20 PM, Steven Schveighoffer <schveiguy yahoo.com> wrote:So without requiring the alias how do you rewrite my example? I'm not saying you are wrong, I just don't grasp what you are saying. An example would be helpful. -SteveHow do you do this without the Template Identity syntax? (I'm going to start calling it this to promote the term I thought was best ;)I'm not suggesting it be removed. I'm suggesting that if you were only able to put one symbol in the template, it would be completely unnecessary. Templates would always resolve to the single symbol that they declare.
Mar 12 2009
On Thu, Mar 12, 2009 at 5:05 PM, Steven Schveighoffer <schveiguy yahoo.com> wrote:On Thu, 12 Mar 2009 16:37:06 -0400, Jarrett Billingsley <jarrett.billingsley gmail.com> wrote:leOn Thu, Mar 12, 2009 at 4:20 PM, Steven Schveighoffer <schveiguy yahoo.com> wrote:So without requiring the alias how do you rewrite my example? =A0I'm not saying you are wrong, I just don't grasp what you are saying. =A0An examp=How do you do this without the Template Identity syntax? (I'm going to start calling it this to promote the term I thought was best ;)I'm not suggesting it be removed. =A0I'm suggesting that if you were only able to put one symbol in the template, it would be completely unnecessary. =A0Templates would always resolve to the single symbol that they declare.would be helpful.It would go along with the suggestion of having some kind of name for the current template. Something like: template Blah(T) { static if(is(T : int)) alias T this template; else alias T* this template; } 'this template' (which reads like English, nicely) would be lexicalized as a single token and would only be legal within templates. But this suggestion is somewhat orthogonal.
Mar 12 2009
On Fri, 13 Mar 2009 03:24:10 +0300, Jarrett Billingsley <jarrett.billingsley gmail.com> wrote:On Thu, Mar 12, 2009 at 5:05 PM, Steven Schveighoffer <schveiguy yahoo.com> wrote:Sean has proposed (or let out a secret?) that: On Thu, 12 Mar 2009 18:02:18 +0300, Sean Kelly <sean invisibleduck.org> wrote:On Thu, 12 Mar 2009 16:37:06 -0400, Jarrett Billingsley <jarrett.billingsley gmail.com> wrote:It would go along with the suggestion of having some kind of name for the current template. Something like: template Blah(T) { static if(is(T : int)) alias T this template; else alias T* this template; } 'this template' (which reads like English, nicely) would be lexicalized as a single token and would only be legal within templates. But this suggestion is somewhat orthogonal.On Thu, Mar 12, 2009 at 4:20 PM, Steven Schveighoffer <schveiguy yahoo.com> wrote:So without requiring the alias how do you rewrite my example? I'm not saying you are wrong, I just don't grasp what you are saying. An example would be helpful.How do you do this without the Template Identity syntax? (I'm going to start calling it this to promote the term I thought was best ;)I'm not suggesting it be removed. I'm suggesting that if you were only able to put one symbol in the template, it would be completely unnecessary. Templates would always resolve to the single symbol that they declare.Oh, and should this actually be: template Blah(Stuff) { alias ... this; } I thought that was the new syntax.
Mar 12 2009
Denis Koroskin escribió:On Fri, 13 Mar 2009 03:24:10 +0300, Jarrett Billingsley <jarrett.billingsley gmail.com> wrote:But maybe "this" gets confused with "this class' instance" (just the meaning, I think there's no ambiguity in the semantic pass). What about: alias T template; ?On Thu, Mar 12, 2009 at 5:05 PM, Steven Schveighoffer <schveiguy yahoo.com> wrote:Sean has proposed (or let out a secret?) that: On Thu, 12 Mar 2009 18:02:18 +0300, Sean Kelly <sean invisibleduck.org> wrote:On Thu, 12 Mar 2009 16:37:06 -0400, Jarrett Billingsley <jarrett.billingsley gmail.com> wrote:It would go along with the suggestion of having some kind of name for the current template. Something like: template Blah(T) { static if(is(T : int)) alias T this template; else alias T* this template; } 'this template' (which reads like English, nicely) would be lexicalized as a single token and would only be legal within templates. But this suggestion is somewhat orthogonal.On Thu, Mar 12, 2009 at 4:20 PM, Steven Schveighoffer <schveiguy yahoo.com> wrote:So without requiring the alias how do you rewrite my example? I'm not saying you are wrong, I just don't grasp what you are saying. An example would be helpful.How do you do this without the Template Identity syntax? (I'm going to start calling it this to promote the term I thought was best ;)I'm not suggesting it be removed. I'm suggesting that if you were only able to put one symbol in the template, it would be completely unnecessary. Templates would always resolve to the single symbol that they declare.Oh, and should this actually be: template Blah(Stuff) { alias ... this; } I thought that was the new syntax.
Mar 12 2009
Jarrett Billingsley wrote:On Thu, Mar 12, 2009 at 9:33 AM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Nice. The problem however is that very, very often I need to store intermediate results, otherwise the code becomes quickly unreadable or spread across too many different non-reusable templates. What I now do is e.g. create a short template Blah(X, Y, Z) that aliases itself to BlahImpl!(X, Y, Z).Result. Hardly elegant. I suggested Walter to allow templates using the eponymous trick to be able to define private symbols. AndreiHello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this?...Unnecessary? You know i have to be contrary :P but I have never found a use for multiple declarations inside a template _except_ when it's used as a mixin. Most of the time, I declare exactly one symbol inside the template, and it's always the same name as the template. Having to specify the name of the template over and over inside it is a blatant violation of DRY, easy to mess up (typos, changing the template name etc.) and is hard to diagnose when you do it wrong, since the compiler just has no idea what you're trying to do and you end up with all sorts of confusing errors about voids having no value. Allowing multiple declarations inside templates looks good in the spec, but honestly, I only ever use it for mixins. My mixin templates are also never used as anything other than mixin templates, creating this sort of split between templates and mixins, even though they're represented by the same language structure. Mixins are really more like a limited form of semihygenic AST macro, one which can only expand to declarations and not arbitrary code structures. If templates were limited to a single declaration - and mixins were either changed to a different "type" or replaced outright by macros - I'd be perfectly happy, and there'd be no need for Implicit Template Name Forwarding (do you see what I just did there ;) ).
Mar 12 2009
On Thu, Mar 12, 2009 at 4:26 PM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Nice. The problem however is that very, very often I need to store intermediate results, otherwise the code becomes quickly unreadable or spread across too many different non-reusable templates. What I now do is e.g. create a short template Blah(X, Y, Z) that aliases itself to BlahImpl!(X, Y, Z).Result. Hardly elegant.That's true.I suggested Walter to allow templates using the eponymous trick to be able to define private symbols.That seems like a reasonable solution. I'm assuming you'd allow templates to define at most one public symbol.
Mar 12 2009
Thu, 12 Mar 2009 06:33:34 -0700, Andrei Alexandrescu wrote:Hello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this? Thanks, Andreimaybe parametrized alias
Mar 12 2009
Sergey Gromov wrote:Thu, 12 Mar 2009 06:33:34 -0700, Andrei Alexandrescu wrote:That sounds good but (I'm saying this to all others who focused on "alias") - the inner name doesn't have to be an alias. AndreiHello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this? Thanks, Andreimaybe parametrized alias
Mar 12 2009
Thu, 12 Mar 2009 18:21:04 -0700, Andrei Alexandrescu wrote:Sergey Gromov wrote:template shortcut?Thu, 12 Mar 2009 06:33:34 -0700, Andrei Alexandrescu wrote:That sounds good but (I'm saying this to all others who focused on "alias") - the inner name doesn't have to be an alias. AndreiHello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this? Thanks, Andreimaybe parametrized alias
Mar 14 2009
Andrei Alexandrescu wrote:Hello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this? Thanks, AndreiEigentemplate.
Mar 12 2009
Christopher Wright wrote:Andrei Alexandrescu wrote:My heart fell among my other integrated circuits. Looks like a huge winner. Thanks Christopher. Oh boy. I wasn't even dreaming about something *this* good. AndreiHello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this? Thanks, AndreiEigentemplate.
Mar 12 2009
On Thu, Mar 12, 2009 at 6:24 PM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Christopher Wright wrote:r.Andrei Alexandrescu wrote:My heart fell among my other integrated circuits. Looks like a huge winne=Hello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { =A0 alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this? Thanks, AndreiEigentemplate.Thanks Christopher. Oh boy. I wasn't even dreaming about something *this* good.Kinda not the same thing if you ask me. Eigen-blah generally refers to something where you've captured the essence of something better by representing it using a different set of basis functions. This doesn't seem to have much of anything to do with that. Its just identity or sameness of name. That's not really what eigen thingys are about. But it is what the word "eponymous" is about. --bb
Mar 12 2009
Bill Baxter wrote:But it is what the word "eponymous" is about.I can't even pronounce "eponymous". Not too catchy :-)
Mar 12 2009
On Fri, Mar 13, 2009 at 12:07 PM, Walter Bright <newshound1 digitalmars.com> wrote:Bill Baxter wrote:R.E.M. thought it was catchy enough to name an album that. :-) Seriously, though, I don't really care what you call it. --bbBut it is what the word "eponymous" is about.I can't even pronounce "eponymous". Not too catchy :-)
Mar 12 2009
Hello Bill,Kinda not the same thing if you ask me. Eigen-blah generally refers to something where you've captured the essence of something better by representing it using a different set of basis functions. This doesn't seem to have much of anything to do with that. Its just identity or sameness of name. That's not really what eigen thingys are about.An Eigen value for a matrix M is a vector V sutch that M x V = V (IIRC)
Mar 12 2009
On Fri, Mar 13, 2009 at 1:30 PM, BCS <none anon.com> wrote:Hello Bill,Close, If M v =3D \lambda v Then \lambda is an eigenvalue (a scalar), v is the eigenvector (a vector) --bbKinda not the same thing if you ask me. =A0Eigen-blah generally refers to something where you've captured the essence of something better by representing it using a different set of basis functions. This doesn't seem to have much of anything to do with that. =A0Its just identity or sameness of name. =A0That's not really what eigen thingys are about.An Eigen value for a matrix M is a vector V sutch that M x V =3D V (IIRC)
Mar 12 2009
BCS wrote:Hello Bill,That's an eigenvector. An eigenvalue is a multiplier alpha such that M x V = alpha V. "Eigen" in German means "its own", proper. I previously liked "the eponymous trick" as it had a nice self-recurrence flavor, but I like "eigentemplates" better. AndreiKinda not the same thing if you ask me. Eigen-blah generally refers to something where you've captured the essence of something better by representing it using a different set of basis functions. This doesn't seem to have much of anything to do with that. Its just identity or sameness of name. That's not really what eigen thingys are about.An Eigen value for a matrix M is a vector V sutch that M x V = V (IIRC)
Mar 13 2009
Bill Baxter wrote:Kinda not the same thing if you ask me. Eigen-blah generally refers to something where you've captured the essence of something better by representing it using a different set of basis functions.That's pretty specific for a German word meaning 'self'.
Mar 13 2009
Andrei Alexandrescu wrote:Christopher Wright wrote:If it's called this, I will have flashbacks to Linear Algebra every time I use it. Just reading this thread brought back my PTSD.Andrei Alexandrescu wrote:My heart fell among my other integrated circuits. Looks like a huge winner. Thanks Christopher. Oh boy. I wasn't even dreaming about something *this* good. AndreiHello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this? Thanks, AndreiEigentemplate.
Mar 13 2009
Robert Fraser <fraserofthenight gmail.com> wrote:Andrei Alexandrescu wrote:And here I thought that'd be a good thing... -- SimenChristopher Wright wrote:If it's called this, I will have flashbacks to Linear Algebra every time I use it. Just reading this thread brought back my PTSD.Andrei Alexandrescu wrote:My heart fell among my other integrated circuits. Looks like a huge winner. Thanks Christopher. Oh boy. I wasn't even dreaming about something *this* good. AndreiHello, I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; } i.e., defining inside a template a symbol of the same name as the template itself. Then you can use Blah!(X, Y) to mean Blah!(X, Y).Blah. What would be a catchy, descriptive, and memorable phrase for this? Thanks, AndreiEigentemplate.
Mar 13 2009
Andrei Alexandrescu Wrote:I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; }verbose templated declaration.
Mar 13 2009
"Kagamin" <spam here.lot> wrote in message news:gpd8ka$1npp$1 digitalmars.com...Andrei Alexandrescu Wrote:As far as I'm concerned, we've found a winner right here ;)I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; }verbose templated declaration.
Mar 13 2009
On Fri, 13 Mar 2009 22:49:00 +1300, Nick Sabalausky <a a.a> wrote:"Kagamin" <spam here.lot> wrote in message news:gpd8ka$1npp$1 digitalmars.com...What's verbose about a template with a single declaration? Verbose adj. "Using or containing a great and usually an excessive number of words" Or is that part of the trickey?Andrei Alexandrescu Wrote:As far as I'm concerned, we've found a winner right here ;)I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; }verbose templated declaration.
Mar 14 2009
Hello Tim,What's verbose about a template with a single declaration? Verbose adj. "Using or containing a great and usually an excessive number of words"there is no compact form for alias but this T Foo(T)(T t) { return t; } is internally identical the the more verbose form: template Foo(T) { T Foo(T t){ return t; } }
Mar 14 2009
On Sun, 15 Mar 2009 06:27:42 +1300, BCS <none anon.com> wrote:there is no compact form for alias but this T Foo(T)(T t) { return t; } is internally identical the the more verbose form: template Foo(T) { T Foo(T t){ return t; } }Hi BCS. On this page: http://www.digitalmars.com/d/1.0/template.html scroll down to "Implicit Template Properties" and it says: "If a template has exactly one member in it, and the name of that member is the same as the template name, that member is assumed to be referred to in a template instantiation". I think Andrei Alexandrescu was actually looking a catchy name for this. You don't have to specify the templates only property, you use the template directly. So its a technique used to make your code less verbose.
Mar 15 2009
Hello Tim,On Sun, 15 Mar 2009 06:27:42 +1300, BCS <none anon.com> wrote:Yes, I known that. I was answering the question you asked about what is verbose about the usage Andrei posted. I was pointing out that if you consider not the feature he was asking about but the form he used, then verbose is a good description. If the example is converted to a function example, as I illustrated, then this becomes even more clear as the form Andrei used is indeed more verbose than the other option. The person who suggested "verbose" as a good name is not totally off base as often, even with functions, you end up needing to switch to the more verbose form to allow static asserts or static ifs around the function.there is no compact form for alias but this T Foo(T)(T t) { return t; } is internally identical the the more verbose form: template Foo(T) { T Foo(T t){ return t; } }Hi BCS. On this page: http://www.digitalmars.com/d/1.0/template.html scroll down to "Implicit Template Properties" and it says: "If a template has exactly one member in it, and the name of that member is the same as the template name, that member is assumed to be referred to in a template instantiation". I think Andrei Alexandrescu was actually looking a catchy name for this. You don't have to specify the templates only property, you use the template directly. So its a technique used to make your code less verbose.
Mar 15 2009
Tim M Wrote:Normally you write templated declaration using only one symbol: class Foo(T1,T2) { ... } The need to use verbose form is a sing of syntactical deficiency of the language.What's verbose about a template with a single declaration? Verbose adj. "Using or containing a great and usually an excessive number of words"Andrei Alexandrescu Wrote:As far as I'm concerned, we've found a winner right here ;)I'm looking for a catchy phrase denoting this D idiom: template Blah(Stuff) { alias ... Blah; }verbose templated declaration.
Mar 16 2009