www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Syntax changing

reply Monkol <dj_mon mail.ru> writes:
i think it is necessary to change template syntax and do as C++ style  
template A <>, and not A !(), A <>. many people come from C++ and it will  
be easy to adapt.
Jun 02 2011
next sibling parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Thu, 02 Jun 2011 16:15:24 -0400, Monkol <dj_mon mail.ru> wrote:

 i think it is necessary to change template syntax and do as C++ style  
 template A <>, and not A !(), A <>. many people come from C++ and it  
 will be easy to adapt.
If this is a legitimate request, and not trolling, this design change was on purpose: http://www.digitalmars.com/d/2.0/templates-revisited.html -Steve
Jun 02 2011
prev sibling parent reply "Nick Sabalausky" <a a.a> writes:
"Monkol" <dj_mon mail.ru> wrote in message 
news:op.vwgs7ypjcqe400 pc-2010.dnepr.net.ua...
i think it is necessary to change template syntax and do as C++ style 
template A <>, and not A !(), A <>. many people come from C++ and it will 
be easy to adapt.
I came from C++, and I found it easy to adapt. Plus, like it says in the link Steve gave, there are technical downsides to using <>.
Jun 02 2011
parent reply "Jonathan M Davis" <jmdavisProg gmx.com> writes:
On 2011-06-02 13:56, Nick Sabalausky wrote:
 "Monkol" <dj_mon mail.ru> wrote in message
 news:op.vwgs7ypjcqe400 pc-2010.dnepr.net.ua...
 
i think it is necessary to change template syntax and do as C++ style
template A <>, and not A !(), A <>. many people come from C++ and it will
be easy to adapt.
I came from C++, and I found it easy to adapt. Plus, like it says in the link Steve gave, there are technical downsides to using <>.
LOL. I use C++ in my job, but I use templates in D so much more than I do in C++ that I now end up using !() instead of <> unless I catch myself. I actually ultimately much prefer !() - especially since you can reduce it to just ! when there's only one template argument and it doesn't have any periods in it. Though honestly, if a programmer can't get used to a slightly different syntax, then they're screwed anyway. Every language has its quirks and differences. Syntax is a very small part of all of that. Really, the syntax is the _easy_ part. It's the semantics where the real problems start as far as adapting to a new language goes. - Jonathan M Davis
Jun 02 2011
parent reply Monkol <dj_mon mail.ru> writes:
On Fri, 03 Jun 2011 00:36:42 +0300, Jonathan M Davis <jmdavisProg gmx.com>  
wrote:

 On 2011-06-02 13:56, Nick Sabalausky wrote:
 "Monkol" <dj_mon mail.ru> wrote in message
 news:op.vwgs7ypjcqe400 pc-2010.dnepr.net.ua...

i think it is necessary to change template syntax and do as C++ style
template A <>, and not A !(), A <>. many people come from C++ and it  
will
be easy to adapt.
I came from C++, and I found it easy to adapt. Plus, like it says in the link Steve gave, there are technical downsides to using <>.
LOL. I use C++ in my job, but I use templates in D so much more than I do in C++ that I now end up using !() instead of <> unless I catch myself. I actually ultimately much prefer !() - especially since you can reduce it to just ! when there's only one template argument and it doesn't have any periods in it. Though honestly, if a programmer can't get used to a slightly different syntax, then they're screwed anyway. Every language has its quirks and differences. Syntax is a very small part of all of that. Really, the syntax is the _easy_ part. It's the semantics where the real problems start as far as adapting to a new language goes. - Jonathan M Davis
the statement to<float("123e2")> is more easy readable then to!float("123e2") for example
Jun 05 2011
next sibling parent "Nick Sabalausky" <a a.a> writes:
"Monkol" <dj_mon mail.ru> wrote in message 
news:op.vwmftxtmcqe400 pc-2010.dnepr.net.ua...
 On Fri, 03 Jun 2011 00:36:42 +0300, Jonathan M Davis <jmdavisProg gmx.com> 
 wrote:

 On 2011-06-02 13:56, Nick Sabalausky wrote:
 "Monkol" <dj_mon mail.ru> wrote in message
 news:op.vwgs7ypjcqe400 pc-2010.dnepr.net.ua...

i think it is necessary to change template syntax and do as C++ style
template A <>, and not A !(), A <>. many people come from C++ and it
will
be easy to adapt.
I came from C++, and I found it easy to adapt. Plus, like it says in the link Steve gave, there are technical downsides to using <>.
LOL. I use C++ in my job, but I use templates in D so much more than I do in C++ that I now end up using !() instead of <> unless I catch myself. I actually ultimately much prefer !() - especially since you can reduce it to just ! when there's only one template argument and it doesn't have any periods in it. Though honestly, if a programmer can't get used to a slightly different syntax, then they're screwed anyway. Every language has its quirks and differences. Syntax is a very small part of all of that. Really, the syntax is the _easy_ part. It's the semantics where the real problems start as far as adapting to a new language goes. - Jonathan M Davis
the statement to<float("123e2")> is more easy readable then to!float("123e2") for example
I find to!float("123e2") more readable. And once again, "like it says in the link Steve gave, there are technical downsides to using <>".
Jun 05 2011
prev sibling next sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 06/05/2011 04:11 PM, Monkol wrote:
 On Fri, 03 Jun 2011 00:36:42 +0300, Jonathan M Davis
 <jmdavisProg gmx.com> wrote:

 On 2011-06-02 13:56, Nick Sabalausky wrote:
 "Monkol" <dj_mon mail.ru> wrote in message
 news:op.vwgs7ypjcqe400 pc-2010.dnepr.net.ua...

i think it is necessary to change template syntax and do as C++ style
template A <>, and not A !(), A <>. many people come from C++ and it
will
be easy to adapt.
I came from C++, and I found it easy to adapt. Plus, like it says in the link Steve gave, there are technical downsides to using <>.
LOL. I use C++ in my job, but I use templates in D so much more than I do in C++ that I now end up using !() instead of <> unless I catch myself. I actually ultimately much prefer !() - especially since you can reduce it to just ! when there's only one template argument and it doesn't have any periods in it. Though honestly, if a programmer can't get used to a slightly different syntax, then they're screwed anyway. Every language has its quirks and differences. Syntax is a very small part of all of that. Really, the syntax is the _easy_ part. It's the semantics where the real problems start as far as adapting to a new language goes. - Jonathan M Davis
the statement to<float("123e2")> is more easy readable then to!float("123e2") for example
Except you ironically got the easily readable syntax wrong... Andrei
Jun 05 2011
prev sibling next sibling parent David Nadlinger <see klickverbot.at> writes:
On 6/5/11 11:11 PM, Monkol wrote:
 the statement to<float("123e2")> is more easy readable then
 to!float("123e2") for example
(You probably meant »to<float>("123e2")«). That's purely subjective (and, by the way, I don't agree with your assertion), while there are objective downsides to using angled brackets – they are ambiguous with the <, >, and >> operators. For example, consider the following pieces of C++ code: »foo<bar<16>>2>>« or just »foo<bar>>« Do you see the ambiguity created here? D doesn't suffer from this problem, since ! is never used as a binary operator. David
Jun 05 2011
prev sibling next sibling parent Mehrdad <wfunction hotmail.com> writes:
 "Monkol" <dj_mon mail.ru> wrote in message
 news:op.vwgs7ypjcqe400 pc-2010.dnepr.net.ua...

i think it is necessary to change template syntax and do as C++ style
template A <>, and not A !(), A <>. many people come from C++ and 
it will
be easy to adapt.
I came from C++, and I found it easy to adapt. Plus, like it says in the link Steve gave, there are technical downsides to using <>.
It's not just a "looks" issue. Doing that would no longer allow the language to be context-free, because of ambiguities with greater-than/less-than operators. http://stackoverflow.com/questions/52506/c-template-ambiguity
Jun 05 2011
prev sibling parent so <so so.so> writes:
On Mon, 06 Jun 2011 00:11:47 +0300, Monkol <dj_mon mail.ru> wrote:

 On Fri, 03 Jun 2011 00:36:42 +0300, Jonathan M Davis  
 <jmdavisProg gmx.com> wrote:

 On 2011-06-02 13:56, Nick Sabalausky wrote:
 "Monkol" <dj_mon mail.ru> wrote in message
 news:op.vwgs7ypjcqe400 pc-2010.dnepr.net.ua...

i think it is necessary to change template syntax and do as C++ style
template A <>, and not A !(), A <>. many people come from C++ and it  
will
be easy to adapt.
I came from C++, and I found it easy to adapt. Plus, like it says in the link Steve gave, there are technical downsides to using <>.
LOL. I use C++ in my job, but I use templates in D so much more than I do in C++ that I now end up using !() instead of <> unless I catch myself. I actually ultimately much prefer !() - especially since you can reduce it to just ! when there's only one template argument and it doesn't have any periods in it. Though honestly, if a programmer can't get used to a slightly different syntax, then they're screwed anyway. Every language has its quirks and differences. Syntax is a very small part of all of that. Really, the syntax is the _easy_ part. It's the semantics where the real problems start as far as adapting to a new language goes. - Jonathan M Davis
the statement to<float("123e2")> is more easy readable then to!float("123e2") for example
No it is not, but if you were talking about templates arguments rather than single argument, you'd have your case. fun!(T1, T2, ... TN)(A1, A2, ... AN); vs fun<T1, T2, ... TN>(A1, A2, ... AN);
Jun 06 2011