Re:Why D kicks serious ass over C++, leaving it dead and bro...
by mojuba on Wednesday October 24, 2007 @06:32PM
(#72244)
Good point, but still, you can apply operator [] to a and b in some non-C dynamic language, which means the "int a[]" style is probably more relevant psychologically.
Re:Why D kicks serious ass over C++, leaving it dead and bro...
by Goladus on Wednesday October 24, 2007 @07:38PM
(#72266)
I agree that int a[10] feels more natural, though if the brackets are empty my only preference is that the language pick one or the other. Don't make "int[] a;" and "int a[];" equally valid syntax, but totally different semantics.
My main point is that this is a relatively cosmetic issue relative to the ability to use 'foreach' syntax instead of iterator objects and while loops.
Re:Why D kicks serious ass over C++, leaving it dead and bro...
by mojuba on Wednesday October 24, 2007 @08:04PM
(#72271)
C++0x addresses those things -- foreach etc.
There's clearly a market for some sort of a fixed C++ but not the Java/C# way. D tries to fill the niche, but it doesn't give a feeling of elegance or otherwise of something really new and unseen before.
Re:Why D kicks serious ass over C++, leaving it dead and bro...
by geek42 on Thursday October 25, 2007 @02:36AM
(#72389)
The article only mentions a few of D's features. There are a lot more improvements. The templating system for instance is quite innovative. http://www.digitalmars.com/d/templates-revisited.html
Variadic Templestes: http://www.digitalmars.com/d/variadic-function-templates.htm...
But there are other things as well like the lazy evaluation, and built in contract and unit test support.
Ave a look at the articles on this page http://www.digitalmars.com/d/
And the specifications http://www.digitalmars.com/d/lex.html
Re:Why D kicks serious ass over C++, leaving it dead and bro...
by mojuba on Thursday October 25, 2007 @06:48AM
(#72439)
Templates in D look like just a syntactically polished variation of C++ templates. Of course there are some new features there, but I don't see anything that can't be done with a compiler that is capable of evaluating some functions at compile-time. C++ can't do that, but my point is, why bother creating such a complicated template system for something that can be done the easy way?
Variadic templates: can be done with variant arrays and again, with smart compile-time evaluation if necessary.
So, for example, you can't do this:
You get a type error, or an lvalue error, because you can't assign anything to a constant.