## 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?
• BCS (2/20) Mar 12 2009 Template ALIASING -> taliasing or tail-asing
• 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
• Andrei Alexandrescu (9/50) Mar 12 2009 Nice. The problem however is that very, very often I need to store
• Sergey Gromov (2/19) Mar 12 2009 maybe parametrized alias
• 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)
• 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?
• BCS (5/10) Mar 14 2009 there is no compact form for alias but this
• Tim M (9/13) Mar 15 2009 Hi BCS. On this page: http://www.digitalmars.com/d/1.0/template.html
• BCS (10/32) Mar 15 2009 Yes, I known that. I was answering the question you asked about what is ...
• Kagamin (7/24) Mar 16 2009 Normally you write templated declaration using only one symbol:
Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
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
jq <jlquinn optonline.net> writes:
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
Don <nospam nospam.com> writes:
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,

Andrei
Selfish template?
Mar 12 2009
Don <nospam nospam.com> writes:
Don wrote:
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,

Andrei
Selfish template?
Transparent template?
Mar 12 2009
Gide Nwawudu <gide btinternet.com> writes:
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,

Andrei
Reciprocal template declaration? Gide
Mar 12 2009
Sean Kelly <sean invisibleduck.org> writes:
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 <sean invisibleduck.org> writes:
Sean Kelly wrote:
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?
Oh, and should this actually be: template Blah(Stuff) { alias ... this; } I thought that was the new syntax.
Mar 12 2009
"Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Thu, 12 Mar 2009 11:01:21 -0400, Sean Kelly <sean invisibleduck.org>
wrote:

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?
Sounds good. I think Template Identity sounds good too. -Steve
Mar 12 2009
Bill Baxter <wbaxter gmail.com> writes:
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:
Hello,
=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?
Sounds good. I think Template Identity sounds good too. -Steve
Mar 12 2009
Bill Baxter <wbaxter gmail.com> writes:
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:
Hello,
=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?
Sounds good. I think Template Identity sounds good too. -Steve
Mar 12 2009

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

Template ALIASING -> taliasing or tail-asing
Mar 12 2009
Ary Borenszweig <ary esperanto.org.ar> writes:
BCS 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,

Andrei
Template ALIASING -> taliasing or tail-asing
Templing?
Mar 12 2009
Walter Bright <newshound1 digitalmars.com> writes:
name promotion
Mar 12 2009
"Nick Sabalausky" <a a.a> writes:
"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> writes:
"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...
Hello,

I'm looking for a catchy phrase denoting this D idiom:

template Blah(Stuff)
{
alias ... Blah;
}
Unitemplate?
...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".
Mar 12 2009
Jarrett Billingsley <jarrett.billingsley gmail.com> writes:
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=
e
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
"Denis Koroskin" <2korden gmail.com> writes:
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:
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?
...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 ;) ).
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#N78698
Mar 12 2009
"Steven Schveighoffer" <schveiguy yahoo.com> writes:
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:
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?
...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.
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; } -Steve
Mar 12 2009
"Denis Koroskin" <2korden gmail.com> writes:
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:

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)
{
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.
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; } -Steve
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).
Mar 12 2009

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
"Denis Koroskin" <2korden gmail.com> writes:
On Thu, 12 Mar 2009 23:56:55 +0300, BCS <ao pathlink.com> wrote:

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.
You could use a tuple or struct for that purpose: template Blah(Stuff) { struct Blah { // code that defines multiple symbols here } }
Mar 12 2009

On Thu, 12 Mar 2009 23:56:55 +0300, BCS <ao pathlink.com> wrote:

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.
You could use a tuple or struct for that purpose: template Blah(Stuff) { struct Blah { // code that defines multiple symbols here } }
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.
Mar 12 2009
"Denis Koroskin" <2korden gmail.com> writes:
On Fri, 13 Mar 2009 00:56:48 +0300, BCS <ao pathlink.com> wrote:

On Thu, 12 Mar 2009 23:56:55 +0300, BCS <ao pathlink.com> wrote:

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.
You could use a tuple or struct for that purpose: template Blah(Stuff) { struct Blah { // code that defines multiple symbols here } }
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 Fri, 13 Mar 2009 00:56:48 +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.

These should be stripped by linked, shoudn't they? That's a separate issue if linker doesn't do it properly.
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.
Mar 12 2009
Jarrett Billingsley <jarrett.billingsley gmail.com> writes:
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
"Steven Schveighoffer" <schveiguy yahoo.com> writes:
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:
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.
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. -Steve
Mar 12 2009
Jarrett Billingsley <jarrett.billingsley gmail.com> writes:
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:

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. =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.
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=
le
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
"Denis Koroskin" <2korden gmail.com> writes:
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:
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:
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.
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.
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.
Sean has proposed (or let out a secret?) that: On Thu, 12 Mar 2009 18:02:18 +0300, Sean Kelly <sean invisibleduck.org> wrote:
Oh, and should this actually be:

template Blah(Stuff)
{
alias ... this;
}

I thought that was the new syntax.
Mar 12 2009
Ary Borenszweig <ary esperanto.org.ar> writes:
Denis Koroskin escribiÃ³:
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:
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:
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.
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.
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.
Sean has proposed (or let out a secret?) that: On Thu, 12 Mar 2009 18:02:18 +0300, Sean Kelly <sean invisibleduck.org> wrote:
Oh, and should this actually be:

template Blah(Stuff)
{
alias ... this;
}

I thought that was the new syntax.
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; ?
Mar 12 2009
Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Jarrett Billingsley wrote:
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)
{
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 ;) ).
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. Andrei
Mar 12 2009
Jarrett Billingsley <jarrett.billingsley gmail.com> writes:
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
Sergey Gromov <snake.scaly gmail.com> writes:
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,

Andrei
maybe parametrized alias
Mar 12 2009
Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Sergey Gromov wrote:
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,

Andrei
maybe parametrized alias
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. Andrei
Mar 12 2009
Sergey Gromov <snake.scaly gmail.com> writes:
Thu, 12 Mar 2009 18:21:04 -0700, Andrei Alexandrescu wrote:

Sergey Gromov wrote:
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,

Andrei
maybe parametrized alias
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. Andrei
template shortcut?
Mar 14 2009
Christopher Wright <dhasenan gmail.com> writes:
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,

Andrei
Eigentemplate.
Mar 12 2009

Eigentemplate.

Doh! :)
Mar 12 2009
Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Christopher Wright wrote:
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,

Andrei
Eigentemplate.
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. Andrei
Mar 12 2009
Bill Baxter <wbaxter gmail.com> writes:
On Thu, Mar 12, 2009 at 6:24 PM, Andrei Alexandrescu
<SeeWebsiteForEmail erdani.org> wrote:
Christopher Wright wrote:
Andrei Alexandrescu 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
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
Eigentemplate.
My heart fell among my other integrated circuits. Looks like a huge winne=
r.
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
Walter Bright <newshound1 digitalmars.com> writes:
Bill Baxter wrote:
But it is what the word "eponymous" is about.
I can't even pronounce "eponymous". Not too catchy :-)
Mar 12 2009
Bill Baxter <wbaxter gmail.com> writes:
On Fri, Mar 13, 2009 at 12:07 PM, Walter Bright
<newshound1 digitalmars.com> wrote:
Bill Baxter wrote:
But it is what the word "eponymous" is about.
I can't even pronounce "eponymous". Not too catchy :-)
R.E.M. thought it was catchy enough to name an album that. :-) Seriously, though, I don't really care what you call it. --bb
Mar 12 2009
BCS <none anon.com> writes:
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

An Eigen value for a matrix M is a vector V sutch that M x V = V (IIRC)
Mar 12 2009
Bill Baxter <wbaxter gmail.com> writes:
On Fri, Mar 13, 2009 at 1:30 PM, BCS <none anon.com> wrote:
Hello Bill,

Kinda 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
An Eigen value for a matrix M is a vector V sutch that M x V =3D V (IIRC)
Close, If M v =3D \lambda v Then \lambda is an eigenvalue (a scalar), v is the eigenvector (a vector) --bb
Mar 12 2009
Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
BCS wrote:
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
An Eigen value for a matrix M is a vector V sutch that M x V = V (IIRC)
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. Andrei
Mar 13 2009
Christopher Wright <dhasenan gmail.com> writes:
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
Robert Fraser <fraserofthenight gmail.com> writes:
Andrei Alexandrescu wrote:
Christopher Wright wrote:
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,

Andrei
Eigentemplate.
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. Andrei
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.
Mar 13 2009
"Simen Kjaeraas" <simen.kjaras gmail.com> writes:
Robert Fraser <fraserofthenight gmail.com> wrote:

Andrei Alexandrescu wrote:
Christopher Wright wrote:
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,

Andrei
Eigentemplate.
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. Andrei
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.
And here I thought that'd be a good thing... -- Simen
Mar 13 2009
Kagamin <spam here.lot> writes:
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
"Nick Sabalausky" <a a.a> writes:
"Kagamin" <spam here.lot> wrote in message
news:gpd8ka$1npp$1 digitalmars.com...
Andrei Alexandrescu Wrote:

I'm looking for a catchy phrase denoting this D idiom:

template Blah(Stuff)
{
alias ... Blah;
}
verbose templated declaration.
As far as I'm concerned, we've found a winner right here ;)
Mar 13 2009
"Tim M" <a b.com> writes:
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...
Andrei Alexandrescu Wrote:

I'm looking for a catchy phrase denoting this D idiom:

template Blah(Stuff)
{
alias ... Blah;
}
verbose templated declaration.
As far as I'm concerned, we've found a winner right here ;)
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?
Mar 14 2009
BCS <none anon.com> writes:
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
"Tim M" <a b.com> writes:
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
BCS <none anon.com> writes:
Hello Tim,

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.
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.
Mar 15 2009
Kagamin <spam here.lot> writes:
Tim M Wrote:

Andrei Alexandrescu Wrote:

I'm looking for a catchy phrase denoting this D idiom:

template Blah(Stuff)
{
alias ... Blah;
}
verbose templated declaration.
As far as I'm concerned, we've found a winner right here ;)
What's verbose about a template with a single declaration? Verbose adj. "Using or containing a great and usually an excessive number of words"
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.
Mar 16 2009