Discover the best of the web!
Learn more about Digg by taking the tour.
Digital Mars - The D Programming Language
digitalmars.com — "It seems to me that most of the "new" programming languages fall into one of two categories: Those from academia with radical new paradigms and those from large corporations with a focus on RAD and the web. Maybe it's time for a new language born out of practical experience implementing compilers."
- 715 diggs
- digg it
- xqb4dpx, on 10/12/2007, -9/+5It doesnt need any runtimes, right ? its native code?
- Xenoxi, on 10/12/2007, -0/+20Yes, it is apparently a native language.
- daveisfera, on 10/12/2007, -8/+5Yes, it's native code.
- Wootery, on 10/12/2007, -7/+7"its native code?"
It compiles to machine code, if that's what you mean. - farther, on 10/12/2007, -21/+35"Native code"? So there's a programming language coming that only Navaho windtalkers can understand?
- simeonb, on 10/12/2007, -0/+6It is both native and contains no runtime. These are not redundant, native languages like haskell (in the glasgow haskell compiler) compile the runtime into the binary. Having no runtime means that there is closer integration to the machine such as a standard way to use assembly language, and it is also trivial to directly link in C code. The base a.exe file is also much smaller (under 250KB for me out of gdc).
- TechnoRabbit, on 10/12/2007, -14/+23That's Navajo, not Navaho. If you're going to make stupid comments, you should probably learn to spell.
- kmk2006, on 10/12/2007, -1/+8Native and fast:
P4 benchmark:
http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all
AMD benchmark:
http://shootout.alioth.debian.org/debian/benchmark.php?test=all&lang=all - brundlefly76, on 10/12/2007, -4/+6Wow, awesome, so way overdue.
I cant think of any language initiative more important then retiring C/C++. - ronaldst, on 10/12/2007, -2/+4@TechnoRabbit
If you feel you have to correct others then do so without being vulgar and insulting. - BuddhaChu, on 10/12/2007, -0/+2@kmk2006
The stats you link to are misleading because D scored WAY better in one category that must have skewed the results. If you compare D to just "C gcc", it's slower by a decent amount.
http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=dlang&lang2=gcc - adinb, on 10/12/2007, -1/+4@farther: That would be the codetalkers.
For info about the codetalkers and their incredible achievements take a look at: http://www.navajocodetalkers.org/ or http://www.history.navy.mil/faqs/faq61-2.htm , or take a look at the wikipedia or stop by Albuquerque, NM and listen to one of the few remaining code talkers speak about their experiences in person. - farther, on 10/12/2007, -0/+1I simply used an alternative, but more romantic term sometimes used to describe them.
- Phr00t, on 10/12/2007, -1/+18I've been programming with D for some time. I was drawn to it for its speed, safety and modern features. It is definetly worth checking out -- also, www.dsource.org has plenty of cool projects using the D programming language, including my project "FreeUniverse". Wish I had more free time to work on it these days :-)
- msikma, on 10/12/2007, -0/+15How about criticism? Surely, this isn't a perfect programming language, so I'd like another side to tell me some of the bad things about this language (even if they don't apply to every user, or if there are very few). A practical comparison with the C family of languages (again, done by someone else than someone from this site) would also be nice, just to learn more about it.
- Wootery, on 10/12/2007, -1/+12Lack of libraries is a biggy - You can't use C++ libraries in D.
(wxD, which ports wxWidgets from C++ to D, does so in an.... interesting way, http://wxd.sourceforge.net/ ) - Phr00t, on 10/12/2007, -0/+7The sad thing is... name mangling and differences between compilers make using libraries from C++ difficult. You can interface with C libraries, using the include file converter. There are some good D libraries coming, most listed on dsource.org.
- zttrx, on 10/12/2007, -8/+5So? You can't use C libraries in B either. No one ever claimed compatibility between completely unrelated languages.
- simeonb, on 10/12/2007, -0/+5I haven't found much that I can think of about the language. It is pretty refreshing, although I haven't done huge projects with it. For me it was difficult to install. You need mingw on windows so that you have gcc, and then you can install gdc (gnu d compiler). The base binary size was 250KB, and with C it might be 25KB or less. There are good ide's like codeblocks that can work with D easily, although you have to install gdc (which requires mingw of course) and then configure codeblocks to use gdc. These are the biggest things that stick out for me. The language is easy to get into although there is a lot to learn about all the features if you are trying to be thorough. It is very clean and consistent though, so learning them is fun and empowering, and not about memorizing inconsistencies.
- pauleric, on 10/12/2007, -7/+17Here's my criticism: So what? It's really not very different than C++ or Java. It doesn't have any features that they don't already have, or can have with libraries. It may have some marginal improvements and simplify a few things, but it's "yet another" language with no compelling reason to exist.
- kmk2006, on 10/12/2007, -2/+6simeonb: The GDC compiler is a bit of a pain to set up but DMD is very easy (just unzip 2 files).
- simeonb, on 10/12/2007, -0/+3kmk2006: Thanks, I will give that a try. I set up DMD months ago and I had to configure text files and their paths to get it to work.
Also I found that by using strip the binary goes down to 144KB. - kylefurlong, on 10/12/2007, -0/+1"Lack of libraries is a biggy - You can't use C++ libraries in D."
Technically true without tools. However, the BCD project here, http://www.dsource.org/projects/bcd/, is making great strides in automating the process of binding C++ libraries in D. At that site you can get the tool itself and the author also maintains a repository of pre-wrapped libraries. - PlancksCnst, on 10/12/2007, -0/+2The biggest problem with D:
-It's not Lisp
- Wootery, on 10/12/2007, -1/+12Lack of libraries is a biggy - You can't use C++ libraries in D.
- zttrx, on 10/12/2007, -5/+13"Time for a new language"? You realize D has been in the works for at least seven years, right? Goddamn people.
- zttrx, on 10/12/2007, -5/+14I'm sorry, what I meant to say was WOOOO A NEW LANGUAGE TOP 100 WAYS TO LERN C# IN TEN MINUTES A MUST READ THE BEST YOU'LL EVER SEE
- trib4lmaniac, on 10/12/2007, -3/+9You forgot "AWESOME" and "AMAZING"
- Torv, on 10/12/2007, -9/+2In development for the last 7 years, yawn, Why did they not just copy the java spec and save some time? Why bother with yet another Algol-look-a-like?
- zttrx, on 10/12/2007, -7/+2I'm sorry if I've missed the amazing new langauge that you've written, Torv. Where can I find a link to it?
- alchemista, on 10/12/2007, -8/+2diggfukt, not a very scalable language I see :)
- cooldudevamsee, on 10/12/2007, -1/+6Dont ruin with name of compatibility, like what other people did with C++.
- cplusplus, on 10/12/2007, -8/+4Doesn't compiled Java make more sense.
- kmk2006, on 10/12/2007, -2/+5Unfortunately, no.
"The problem now is, that the Java API classes are heavily interconnected; a simple "Hello World" application uses the security manager which uses AWT which uses... Because of this, you will always have a big part of the class library in your binaries"
Compiling a simple 'hello world' app with GCJ (native compiler) results in a 10 meg binary. - cplusplus, on 10/12/2007, -0/+3Well, not 10 Meg. Here I read its 8M - or 5 stripped.
http://comments.gmane.org/gmane.comp.gcc.java.devel/13001
But you have a point. - kmk2006, on 10/12/2007, -0/+2cplusplus: I think that's a little old. With each new version of GCJ, the class library has become larger and larger. When I said 10 meg
binaries, I meant when GCJ 4.2 is used.
http://www.thisiscool.com/gcc_mingw.htm
- kmk2006, on 10/12/2007, -2/+5Unfortunately, no.
- Pxtl, on 10/12/2007, -2/+8The problem with D is that it was designed to simply "fix C++" rather than to design a new, better language. If you expand your horizon outside of the rather limited family of C/Pascal derivatives, you'll find that there are numerous other programming language concepts that were, until recently, horribly implemented in these conventional languages. D really doesn't address these concepts at all, any more than C++ does. C# 3.0 is finally adding various functional programming concepts and relational language concepts into it, and yet the C# userbase is screaming about the "impurity" of these ideas - but C# has it's own pile of flaws.
There's nothing like watching the development of programming languages to realize that the software development community is populated almost entirely by screaming children.- zttrx, on 10/12/2007, -3/+81. If there's a better all-purpose language than C, I'd like to know what it is, and exactly why. (and I'm not talking about C++, I'm talking about C)
2. Why did you mention C#? C# has as much to do with C as .NET has to do with Java. - simeonb, on 10/12/2007, -0/+3I wouldn't say that D fixes C++ because it throw away compatibility with it. I think it does the same things better than C++ through design experience. From reading the message boards, there were lots of ideas from difference language incorporated. Auto type inference, templates, integrated data structures etc. Functional programming techniques could be added easily with a library as they were with Python, but yes, they are not there now. Check out this filter function I wrote yesterday, it seems to work well, and you have control over what gets copied where. In retrospect, I could have just used the original array.
int[] filterInt(int[] a, bool delegate(int n) filterTest)
{
// copy by value a = b would be copy by reference, and actually this isn't necessary at all
int[] filteredList = a[];
int flIndex = 0;
// auto type inference
foreach(x;a)
if( filterTest(x) ) {
filteredList[flIndex] = x;
flIndex++;
}
filteredList.length = flIndex;
return filteredList;
} - Pxtl, on 10/12/2007, -1/+5@zttrx
I mention C# because it is just the most recent descendant in the C language family. And while you may think it's pretty far from C, it looks a hell of a lot more like C than does, say, Lisp or Forth.
Lisp is a perfect example of a language whose lessons have been forgotten. Rather than try to implement the be-all and end-all language, Lisp is just a set of simple constructs that can be used to express any more complex linguistic concept - OOP is implemented as a set of macros. Now, is Lisp perfect? Of course not. But does anyone have any business designing a language without experiencing languages like Lisp or Caml? Hell no.
C is wonderful at what it was designed for - legible, high-speed assembly-like code, and legible arithmetic. But once you start describing more complex concepts in it, you start running into places where the language is clumsy, unsafe, and messy. The problem is that newer languages take the equally stupid approach of _forcing_ simplicity and safety on you, instead of allowing you to construct safe objects (which C++ laudably introduced). - smitting, on 10/12/2007, -0/+6I'm not a big Microsoft fan in general, but I actually prefer the c# syntax for delegates:
delegate bool FilterTest(int n);
int[] filterInt(int[] a, FilterTest filterTest)
{
List ret = new List();
foreach (int x in a) { if (filterTest(x)) ret.Add(x); }
return ret.ToArray();
} - simeonb, on 10/12/2007, -0/+2smitting: I can see that there are advantages to that. C# looks pretty good. There are two things going on though. One is that the delegate is defined in another line ( probably not a big deal, it makes a cleaner function declaration, but it means that if the delegate declaration isn't right there with the function then it could be unclear). The other is that an empty list is declared and elements are added to it, meaning that we don't know how the memory is being copied with the resizing of the array. It is a clearer example for sure though.
- waenyinepu, on 10/12/2007, -0/+2There's a somewhat more concise filter function available in the Cashew library for D (which I maintain, I admit it, so I'm slightly biased, oh well). It is defined as a function template as well, and is suitable for IFTI "pseudo-member" usage. (Its a D'ism. Read on for example.) The following is direct copy+paste (other than the # prefix) from the Cashew repository.
# T[] filter (T) (T[] haystack, bool delegate (T) dg)
# body {
# T[] result ;
#
# foreach (needle; haystack) {
# if (dg(needle)) {
# result ~= needle;
# }
# }
# return result;
# }
# unittest {
# _begin(r".filter(Dlg)"c);
# int[] foo = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
# auto sub = foo.filter((int x) { return (x % 2) == 0; });
# assert(sub == [2, 4, 6, 8, 10]);
# _end;
# }
Once we get type inferance for delegate literals it will become that little bit more generic. Cashew is located at:
http://www.dsource.org/projects/cashew
Now to explain that "pseudo-member" D'ism. Its really just a side-effect of the D's properties concept, which causes the use of AnyArray.AnyFunction() to be the same as AnyFunction(AnyArray). Not a true feature per se (it was added by accident... so of course, we all loved it) but it can sometimes make expressions a bit more readable (less nesting of the parentheses, chaining instead).
if (validate(convert(acquire("blah")))) { ... }
versus
if("blah".acquire().convert().validate()) { ... }
- zttrx, on 10/12/2007, -3/+81. If there's a better all-purpose language than C, I'd like to know what it is, and exactly why. (and I'm not talking about C++, I'm talking about C)
- smitting, on 10/12/2007, -2/+9Here's the language comparison chart:
http://www.digitalmars.com/d/comparison.html
Personally, I prefer C# since it's almost the same thing. D doesn't require a VM, but C# comes with a huge library. VM performance isn't a problem anymore (do some testing if you don't believe me). Cross platform with D is nice (Mono works sometimes) but I'm dealing with server code most 99% of the time, so platform already isn't an issue.
And some of the features this chart mentions as missing c# features are available in the .Net library, like associative arrays....
Dictionary<string,int> would declare an associative array of ints keyed by strings, Dictionary<Identity, HttpRequest> would declare an associative array of page requests keyed by the user's identity.- bnolsen, on 10/12/2007, -3/+4The biggest hit on c# is the lack of guaranteed resource cleanup.
Both java and c# can't guarantee that a resource will be freed up when you tell it to free up.
That is true in 'D'.
One thing about 'D' that sends up warning signals...c++ has ~70 or so keywords. In 'D' that increased to over 90. To me that's not a good sign.
I would agree that 'D' is likely a good improvement over c++. It's development so far has been pretty stable. And so far it's not fragmented like c++ has. Let's keep this language cross platform (and keep Microsoft out of it!) - ermau, on 10/12/2007, -0/+2Hashtable is even better as it has no single type requirement for either the key or the values.
- cg0def, on 10/12/2007, -2/+5@bnolsen yes, both java na c# do not allow direct access to the underlying architecture because those are not OS programming languages. Both languages were designed with an already existing OS in mind. ( java not so much at the beginning ) And if you must use c# as an example you should also remember that the implementation of c# used by MS requires the use of .NET and in that case there is no problem to write the particular module that needs tight memory control in C++. However, about 95% of all code ever written does not need those features and the benefits of writing code faster largely outweigh the drawbacks of using a little bit more RAM.
Anyway my biggest problem with D is that its one more language that has only the support of a small community. The single largest reason why C/C++ is as popular as it is today is the large developmental community around them. Never mind the fact that there are vast numbers of libraries that do pretty much everything you can think of. There is an international and industry wide committee that controls the way C++ develops and at the end of the day most of those same companies would be writing the next OS or the next Office Suite. So what chance does D have in competing with C++? None whatsoever. Anyone who believes that a programmer can chose what language to use is either insane or has never worked for a 50+ devs. company. You have a project manager and he/she has a boss as well and at some point up the management ladder there is a chain of people that know only that they want to software to be ready yesterday and to work great. So one of the managers choses a well know well proven language that it's not going to be D even on it's best day. No offense but I wouldn't chose a no-name language even if my company was just starting up.
So the only playground for D left are OSS projects. Well some have picked it up but it still requires considerable retraining and I can understand why most devs are reluctant to pick it up even if it is as great as the site says. No offense guys but you don't even have an IDE and the installation on anything but a couple of flavors of linux is hell. Long gone are the 80s when IDEs were text based and you had to use a terminal/console in order to compile. At it's current stage D looks very much like an academic project only it doesn't really have the backing of one. It is a great project though and I wish the maintainers had a little bit more business skill ... - TheJeffer, on 10/12/2007, -0/+3.Net programs don't actually run in a VM. It's a common misconception, because people think it's like Java. Programs actually get Just-In-Time compiled into native code when you run them. And half the time, that's not even an issue, because a good programmer will use a tool provided by Microsoft called ngen that will do the precompilation once and then store the resulting native code in the user's cache... meaning you're basically just running native code. What .Net is, more than anything else, is a great framework of libraries.
- unikuser, on 10/12/2007, -1/+0@TheJeffer
That shows that you have no idea of what ngen does. It does not remove need of VM completely. It just compiles parts(say 20%) of ur program which can be converted. Even then, all the bound check(array,object...) will still be there and they require a VM. So VM(~25MB download) is still necessary for your program to run.
- bnolsen, on 10/12/2007, -3/+4The biggest hit on c# is the lack of guaranteed resource cleanup.
- dmh2000, on 10/12/2007, -3/+2>"It seems to me that most of the "new" programming languages fall into one of two categories: Those from academia with radical new paradigms and those from large corporations with a focus on RAD and the web
you mean like Ruby and Python?- minisu, on 10/12/2007, -2/+3Yes, those would fall into the category "RAD and the web" if you generalize.
- Pxtl, on 10/12/2007, -1/+6Yep. I agree that the disjoint nature of language development is appalling. The professional (and hobbyist) world is forever trying to re-invent C++, while the academic world is building towers of confusion in which you can express anything you like tersely, but nobody can understand it (or use it since there aren't any libs).
- dmh2000, on 10/12/2007, -0/+1yes, RAD and web, but which source, academia or large corporation?
- kmk2006, on 10/12/2007, -1/+6Somebody should note that the long awaited 1.0 version of D will be available very soon (probably within a few days).
- AkshayGenius, on 10/12/2007, -8/+3www.dsource.com
- kmk2006, on 10/12/2007, -0/+7www.dsource.org
- dorlic, on 10/12/2007, -1/+2It's not real until there is an eclipse plugin for it. ;-)
- kmk2006, on 10/12/2007, -0/+6There is one though it's not complete - http://www.dsource.org/projects/descent
- ilitirit, on 10/12/2007, -0/+7Obligatory link to Kenta Cho's games.
http://www.asahi-net.or.jp/~cs8k-cyu/index_e.html
Shoot 'em Ups written in D
:-) - asterite, on 10/12/2007, -0/+3And Descent it's not a dead project: soon it'll be usable and I'll be adding features to it while you can use it and test it. :-)
- elhaf, on 10/12/2007, -5/+2>Maybe it's time for a new language born out of practical experience implementing compilers
No, it's not. Compiler writers are great at making languages in which it is easy to write compilers. For other application domains, not so much. - malice8691, on 10/12/2007, -9/+2Do we really need another language?
- Geekiest, on 10/12/2007, -12/+1Whats wrong with C?
As far as I can tell, this really adds nothing new...
*****sarcasm******
http://www.digitalmars.com/d/comparison.html
Look at that list of Oh so useful features!!!!!
Ooooh, resizing arrays, that really cutting edge, only that anybody who can use C at all knows the MALLOC and REALLOC basically comprise any type of array resizing you need.
Built in strings! Oh boy!
Wow, OOP support, I'm feeling giddy!
Oh, and exception handling, and saftey so ***** programmers to shoot themselves in the foot! Ever since I started using C i've been itchin' for that!
And you certainly can't do struct alignment w/ a line of inline assembly in C, its a "really innovative and abstract feature" *cough* no it isnt *cough*
"Associative arrays"!!!!!! gee golly, there's no easy way to do that in C, after all, theres no one line library implementation, how could I be so blind! I'll start using D right away!
Any way, who needs macros, when have such a "sophisticated" language, I mean, you can just do w/o them. Even if your code is a bit longer (and hard to read), its ok, becuase you have dynamic arrays!!!!!
woohoo, "Scope guards" and "Guaranteed initialization", now I'll never makes stupid mistakes again, and ill be a worse programmer for it, becuase who needs to actually know these things when you have D!!!!
*******end sarcasm******
"Direct native code gen", sorry guys, that's not a feature, its a design choice, w/ pros and cons. Ditto for "Independent of VM", and arguable, that is bad. Many of these features have dependencies, especially OOP stuff, its not as impressive as their heavily spun chart makes it look.
Theres simply no need for a language like this, which is designed to replace C. At the moment I see two types of languages, those moving towards a greater abstraction via VM, which actually add convient features for application programming, such as dynamically typed variables, and low level languages like C, designed for CONTROL, AND PERFORMACE. As best as I can tell, D is some sick hybrid of Java and C tries to protect the ever so stupid user from messing up, which will undoubtably lead to less competent low level programmers. If you want abstraction, just go the full way, not this half-assed attempt at abstract native code. How can a language clearly designed for conveniance do away w/ macros?
I also hate the bashing of "academic" languages, which are often quite powerful (lisp comes to mind). Not only that, but they ignore languages like Python, Lisp, Perl and Ruby in their comparison, as these are actually far closer to D (in principle, not design) than C or C++.
I really can't see myself using this language.- kmk2006, on 10/12/2007, -0/+10Something tells me you just don't want to learn another language.
- anastrophe, on 10/12/2007, -4/+1my conflict is which of the two stories about the same thing on the front page to digg down. decisions, decisions.
- EEBaum, on 10/12/2007, -0/+3Why not both? :P
- postalservice14, on 10/12/2007, -1/+2holy slow download speeds batman! mirror anyone?
- mike503, on 10/12/2007, -0/+2a coworker of mine once told me he wanted to make a language called D, with the best of C and C++ worlds...
i'm trying to see if his name is in here. that'd be a gas.- Onestone, on 10/12/2007, -0/+1"with the best of C and C++ worlds"
That would be C++.
- Onestone, on 10/12/2007, -0/+1"with the best of C and C++ worlds"
- user98887, on 10/12/2007, -2/+1Another programming language that will finally solve all programming issues.
Oh wait wasn't that "Java" - No one will want to use anything else
Then C#, we can convert all our old code to C#
Maybe "E" will solve the issue - Still plenty of letters left in the alphabet - achacha, on 10/12/2007, -0/+2Personally I don't want garbage collection, I want to control when and how memory gets deallocated. If I wanted that I would choose Java or C#. And you know what, I love multiple inheritance, but it's not meant for the weaker programmers, so while most will point out its evils, I can point out its many advantages. C++ is a great language, which is great for pretty much anything in the right hands, for scripting we have Python and Ruby, for higher level development we have Java and C#... I can't see a reason why I would switch to D.
- Corneliusm, on 10/12/2007, -0/+2Garbage collection is optional. You can explicitly allocate and deallocate memory using your favorite keywords (new and delete) if you want control. Otherwise, a garbage collector handles memory management for those afraid of having to fix memory leaks.
Still, as a C++ developer, I don't see any new features in D that excite me enough to switch over. Maybe if the industry begins to shift, I'll force myself to learn...
- Corneliusm, on 10/12/2007, -0/+2Garbage collection is optional. You can explicitly allocate and deallocate memory using your favorite keywords (new and delete) if you want control. Otherwise, a garbage collector handles memory management for those afraid of having to fix memory leaks.
- w3bsmith, on 10/12/2007, -0/+2All the nay-sayers comments say the same thing I've felt for the 4 years I've known about this language.
Where are the advantages? Why would you learn some new form of C unless forced to? That's my main hold back from learning C# more thoroughly. If I don't need to learn it, and if it adds nothing new to my range of problems to solve, no new tool with which to solve them, then why should I bother?
I must admit I did try it years ago. The thing that spurred me on into trying it was because I had spent a delightful few months having learned another new language; Ruby. Having been pleasantly delighted by one I felt hopeful about the other. What a let down.
Give me Ruby any day. I can blend it easily into C for those sometimes needed speed boost, and I can still have LISP like ease of reading! I agree that every programmer should use LISP, Pascal, Assembly, et cetera before moving on to new languages. You learn an appreciation for and are more discrete in your choices of new languages and their uses. - TheSiz, on 10/12/2007, -2/+1I remember hearing about it about 4 years ago.
My opinions about it remain the same:
Yea it's there, but who gives a *****? - waenyinepu, on 10/12/2007, -0/+2As of about an hour ago, the 1.00 release has been posted. Bound not to be perfect, but we're lucky to have gotten this far. (And poor Walter... what with all our whipping at him, we're lucky he's stuck with his project despite us D users.)
- Continuum, on 10/12/2007, -0/+2The biggest problem I see here is not with D but with programmers thinking that there should be only one language.
Each language out there (that is in common use) has its following for a reason and has been shown to work properly. Sure, for example, it may be easier to read code Java than in C but is readability of code for your application important? or is performance important? or cross-platform compatibility?
I hate when programmers bicker over the "best" language to use because, really, they are all good when used for their purpose.
anyways, off the rant. And if we are going to say what language is best, iI vote for *****.
http://www.muppetlabs.com/~breadbox/bf/- condor87, on 10/12/2007, -0/+0Ditto. Did I mention I'm developing a ***** virtual machine? Should design a Web2.0-*****-website and digg it. Euh, anyway... ;-)
- lnostdal, on 10/12/2007, -0/+2Nothing new here .. *continues Lisp-hacking*
- DavidDigg, on 10/12/2007, -0/+1Paul Graham has some interesting ideas on language design http://www.paulgraham.com/hundred.html
- kitchenlinker, on 10/12/2007, -0/+0D looks really good to Kitchen Linker http://kitchenlink.blogspot.com/search/label/d
Can't wait to start programming in it.
Change in degree rather than kind vs C++. Sure, but it's as good and big a change as can cross the chasm.
Go D! - tlehman, on 10/12/2007, -0/+1I remember when D came out, back in my day, it looked promising, and I havn't used it enough to have a valid opinion of it, I would say that I don't see a big need for it, but it looks promising that there is still progress in the native-level realm of higher level languages, because C++ is already 22 years old.
- destroyer8, on 10/12/2007, -0/+0Hi,
D is exactly what we have been looked for the last years. A hella fast language without
a few ugly issues of c++.
Various benach mark sites place D just close to C/C++ (e.g. http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all).
In order to test the speed, we wrote a simple bench (Towers of Hanoi Problem):
**********************************************************
Java1.6 Client VM (11.8 sec) | Java1.5 Client VM (14.4 sec)
**********************************************************
public class Hanoi {
public static void main(String[] args) {
long l = System.currentTimeMillis();
System.out.println(l);
solve(1, 2, 3, 30);
long l2 = System.currentTimeMillis();
System.out.println(l2);
long diff = l2 -l;
System.out.println("result " + diff);
}
static void solve(int from, int aux, int to, int numdiscs) {
if (numdiscs == 0)
return;
solve(from, to, aux, numdiscs - 1);
solve(aux, from, to, numdiscs - 1);
return;
}
}
**********************************************************
D without -O flag (32 sec) | with -O flag (12 sec)
**********************************************************
import std.stdio;
import std.c.time;
int main(char[][] args) {
void solve(int from, int aux, int to, int numdiscs) {
if (numdiscs == 0)
return;
solve(from, to, aux, numdiscs - 1);
//writefln("%d to %d", from, to);
solve(aux, from, to, numdiscs - 1);
return;
}
int *l;
time_t tNow = time(l) * 1000;
writefln("%d", tNow);
solve(1, 2, 3, 30);
writefln("solved hanoi problem");
int *l2;
time_t l2Now = time(l2) * 1000;
writefln("%d", l2Now);
long result = l2Now -tNow;
writefln("%d", result);
return 0;
}
**********************************************************
C++ (16 sec) without any optimization flag
**********************************************************
#include
#include "time.h"
long count = 0;
int solve(int from, int aux, int to, int numdiscs) {
count++;
if (numdiscs == 0)
return 0;
solve(from, to, aux, numdiscs - 1);
solve(aux, from, to, numdiscs - 1);
return 0;
}
int main()
{
time_t msec = time(NULL) * 1000;
printf("%dn", msec);
solve(1, 2, 3, 30);
time_t msec2 = time(NULL) * 1000;
printf("%dn", msec2);
long result = msec2-msec;
printf("%dn", result);
printf("%i", count);
return 0;
}
We are wondering about the measured times...
Babak Sayyid Hosseini - Chickenman451, on 10/12/2007, -0/+0Digital Mars' dmd is a reference implementation. It's not necessarily very well optimized -- yet it does a good job holding its own against GCC's C and C++. I wonder how well GCC gcd version fairs in the competition.
- Chickenman451, on 10/12/2007, -0/+0@user98887
There's even more letters available if you use Unicode. - hasanyasin, on 10/11/2007, -0/+0I won't talk about D, the problem here is not a new or old programming language, it is the programmers' approach to new things. What can be the problem with a new language for a programmer? Laziness to read and learn new things?
Being a programmer for more than 15 years I love learning new languages and every new thing makes me happy(: We are improving, we are developing new things and advancing our lives. D is not an exception. It's a new language, a new concept, a new technology, a new thing to learn...
I have been using C since I started coding and love it. I have been using C++ for more than 12 years and love it too. I also love Python, LISP, my cordless keyboard/mouse set, my Casio watch, my new laptop ... And D will be the next lovely thing for me. Learning a new language should not be a job that we do if and only if we are forced to. Try it, take some steps. If you like it, you may continue; if you don't like, you may leave; but there is not any logical and acceptable reason for negatively talking about and hating something that you didn't read and don't know anything about. - partypokerbonus, on 10/11/2007, -0/+0can't we all just use HTML and be happy? It's teh sexy
- iamdexter, on 10/11/2007, -0/+0"Dont ruin with name of compatibility, like what other people did with C++."
gotta agree.
http://www.pawas.com/store/category/betseyjohnsonshoes/ - yogastore, on 06/30/2008, -0/+0http://astore.amazon.com/calphalon.commercial-20
http://astore.amazon.com/calphalon.contemporary-20
http://astore.amazon.com/black.and.decker.lawn.hog ...
http://astore.amazon.com/black.and.decker.oven-20
http://astore.amazon.com/cast.iron.skillet-20
http://astore.amazon.com/12.electric.skillet-20
http://astore.amazon.com/6.quart.pressure.cooker-2 ...
http://astore.amazon.com/electric.pressure.cooker- ...
http://astore.amazon.com/8.inch.chefs.knife-20
http://astore.amazon.com/chefs.choice.knife-20
Digg is coming to a city (and computer) near you! Check out all the details on our