On C/C++ undefined behaviours

Jonathan M Davis jmdavisprog at gmail.com
Sat Aug 21 18:31:16 PDT 2010


On Saturday 21 August 2010 08:03:18 dsimcha wrote:
> == Quote from Jonathan M Davis (jmdavisprog at gmail.com)'s article
> 
> > Hopefully D will prove to be a solution with development benefits
> > on par with Java and .NET and efficiency benefits on par with C++.
> > - Jonathan M Davis
> 
> If "on par" with Java and .NET is all we're aiming for, then we've really
> set the bar low.  I think that D's metaprogramming/generic system will set
> the bar much higher once D gets more library and tool support.
> 
> I've thought about how I would implement an API with comparable ease of use
> and flexibility for some libraries I've written or used in D, using Java,
> C# or C++. I don't think it's possible.  The only other languages where I
> think a similarly easy to use API would be implementable are the (really
> slow) dynamic languages like Python and Ruby.
> 
> For an example, try implementing an API comparable to std.range in
> flexibility and ease of use in any statically typed, efficient language
> besides D.

I think that that it's always good to do better. However, the fact remains that 
generally in a language, you either get power and efficiency, or you get ease of 
use and speed of development. C++ tends to be powerful and efficient but not 
particularly easy to use and not all that fast to develop in. Java and C# are 
nowhere near as powerful as C++, but they avoid a lot of its problems which make 
them far easier to use and maintain, so development goes faster. D is looking to 
hit both of those camps. If it manages the efficiency of C++ and the ease and use 
and maintainability of C# and Java, that's a huge achievement.

Howevever, I am by no means saying that we should strive to be "only" as good as 
C++ for efficiency or "only" as good as C# and Java for ease of use and speed of 
development. Any gains that we can have over them would be fantastic. In 
particular, if D were to be considered much better in those areas by enough 
people, then it would likely really catch on - not  to mention, as users of D, 
we want it to be as good as possible.

But still, being able to consistently match C++ at what it's good at and C# and 
Java at what they're good at in one language is big, and I really don't think 
that we're there yet. I don't know how efficient we are in comparison to C++, but 
I expect that there are a number of areas which need improvement (things like 
inlining, the garbage collector, etc.) if we want the average D program to match 
the average C++ program for efficiency. And we definitely don't match Java and C# 
for ease of use and maintainability at this point, but most of that is simply an 
issue of libraries and tools, both of which are being worked on. So, we're 
getting there, but I don't think that we're there yet. And certainly, once we do 
get there, there's no reason to stay only "on par" with them. We should always 
be looking to improve D and its libraries and tools.

- Jonathan M Davis


More information about the Digitalmars-d mailing list