digitalmars.D - Template declaration/instantiation
- Tom (5/5) Mar 04 2006 Just for curiosity: why template declaration doesn't use '!()' instead o...
- Carlos Santander (14/21) Mar 04 2006 The ! syntax was added after the () syntax. Formerly, it was:
- Jarrett Billingsley (7/12) Mar 04 2006 It has to do with it being a context-free grammar. That is, if template...
- Tom (4/16) Mar 04 2006 I'm not complaining about !(). I'm asking, why not use !() in the templa...
- Walter Bright (3/5) Mar 04 2006 Because it's unnecessary from a syntactical point of view.
- Tom (3/8) Mar 04 2006 I know, but it seems more coherent even though it's unnecessary.
Just for curiosity: why template declaration doesn't use '!()' instead of '()'. Wouldn't using the same symbols in both (the declaration and the instantiation) be a little more "consistent" to the sight? Regards, Tom;
Mar 04 2006
Tom escribió:Just for curiosity: why template declaration doesn't use '!()' instead of '()'. Wouldn't using the same symbols in both (the declaration and the instantiation) be a little more "consistent" to the sight? Regards, Tom;The ! syntax was added after the () syntax. Formerly, it was: template Foo(T) { } class A { } instance Foo(int) Foo_int; instance Foo(A) Foo_A; Later on, instance was deprecated and ! came to life. I believe the instance syntax is not valid now. -- Carlos Santander Bernal
Mar 04 2006
"Tom" <Tom_member pathlink.com> wrote in message news:duca8l$1mik$1 digitaldaemon.com...Just for curiosity: why template declaration doesn't use '!()' instead of '()'. Wouldn't using the same symbols in both (the declaration and the instantiation) be a little more "consistent" to the sight?It has to do with it being a context-free grammar. That is, if templates just used plain old parentheses, it would take more work to determine what the symbol was that preceeded them. I like !(), I see it and immediately know I'm dealing with a template. It's like how <> stands out in C++ templates.
Mar 04 2006
In article <ducfbj$1vds$1 digitaldaemon.com>, Jarrett Billingsley says..."Tom" <Tom_member pathlink.com> wrote in message news:duca8l$1mik$1 digitaldaemon.com...I'm not complaining about !(). I'm asking, why not use !() in the template declaration as well. Tom;Just for curiosity: why template declaration doesn't use '!()' instead of '()'. Wouldn't using the same symbols in both (the declaration and the instantiation) be a little more "consistent" to the sight?It has to do with it being a context-free grammar. That is, if templates just used plain old parentheses, it would take more work to determine what the symbol was that preceeded them. I like !(), I see it and immediately know I'm dealing with a template. It's like how <> stands out in C++ templates.
Mar 04 2006
"Tom" <Tom_member pathlink.com> wrote in message news:ducikm$232g$1 digitaldaemon.com...I'm not complaining about !(). I'm asking, why not use !() in the template declaration as well.Because it's unnecessary from a syntactical point of view.
Mar 04 2006
In article <ducljs$28f8$1 digitaldaemon.com>, Walter Bright says..."Tom" <Tom_member pathlink.com> wrote in message news:ducikm$232g$1 digitaldaemon.com...I know, but it seems more coherent even though it's unnecessary. Tom;I'm not complaining about !(). I'm asking, why not use !() in the template declaration as well.Because it's unnecessary from a syntactical point of view.
Mar 04 2006