View Full Version : D - King of Languages
JesusCyborg
02-07-2004, 10:18 PM
D is made by Walter Bright, one of the best programmers alive. He wrote the Symantec C++ compiler, Zortech C, Digital Mars C++, and now we have D
Manual:
http://www.digitalmars.com/d/index.html
Language Feature Comparison:
http://www.digitalmars.com/d/comparison.html
Example code:
/* Sieve of Eratosthenes prime numbers */
bit[8191] flags;
int main()
{ int i, count, prime, k, iter;
printf("10 iterations\n");
for (iter = 1; iter <= 10; iter++)
{ count = 0;
flags[] = 1;
for (i = 0; i < flags.length; i++)
{ if (flags[i])
{ prime = i + i + 3;
k = i + prime;
while (k < flags.length)
{
flags[k] = 0;
k += prime;
}
count += 1;
}
}
}
printf ("\n%d primes", count);
return 0;
}
jemfinch
02-07-2004, 10:53 PM
Is that supposed to be somehow more elegant than this (http://www.bagley.org/~doug/shootout/bench/sieve/sieve.ghc)? Because it certainly isn't faster.
D is a just a copycat of what so many other dime-a-dozen OOPLs have been doing for years, with a poor syntax to boot. Mr. Bright fails to impress.
Jeremy
JesusCyborg
02-08-2004, 06:01 AM
Originally posted by jemfinch
Is that supposed to be somehow more elegant than this (http://www.bagley.org/~doug/shootout/bench/sieve/sieve.ghc)? Because it certainly isn't faster.
D is a just a copycat of what so many other dime-a-dozen OOPLs have been doing for years, with a poor syntax to boot. Mr. Bright fails to impress.
Jeremy
omfg you just made a total ass of yourself. i don't think you know anything about D and yes, it's faster and a better language than Haskell. pfft.
D has many more features than any other language and compiles the old-fashioned way.
D is a copycat? That's like saying Java is a C++ copycat and that C++ was a C / SmallTalk copycat.
GnuVince
02-08-2004, 12:17 PM
jesus is about to get a lessin programming from jemfinch.
And I agree with jemfinch, D uses the same sucky C syntax, does not provide any revolutionary feature that would make people want to use it. We're in the 2000's, please make languages that are modern, not copies of 70's languages.
JesusCyborg
02-08-2004, 01:35 PM
Just because the syntax style was developed in the 70's doesn't mean it needs to be updated. The point is to be objective, not "new" for the sake of new.
The languages I like/respect the most are Java, D, and C.
Whiteknight
02-08-2004, 05:55 PM
C had plenty of flaws inherent in it that C++ was supposed to correct. C++ did fix many of those flaws, but remained entirely backwards compatable, which allowed lazy programmers to get away with the same mistakes over and over again.
a true next-gen C-style language would be something along the lines of COOP (http://linuxselfhelp.com/HOWTO/C++Programming-HOWTO-1.html) or Resolve (http://www.cis.ohio-state.edu/~weide/sce/rcpp/FAQ/) (thanks to jemflinch for that resolve link). a language that copies C syntax and methodologies is only a step in the wrong direction.
Strike
02-08-2004, 05:59 PM
It looks like D just tries to pack any old feature into it. What the heck are function delegates? Why the hell would you want to modify the arguments to a function? Why can't you use multiple inheritance?
Also, everything else in their little feature list is also in Python and Haskell, except for obvious things like no C-style syntax (which is a big minus, C syntax is far from natural or intuitive) and some of the more unimportant and random things that they have on the list.
jemfinch
02-08-2004, 08:10 PM
Originally posted by JesusCyborg omfg you just made a total ass of yourself.
No, I didn't. You did, actually, first by actually typing "omfg" and second by not knowing what you're talking about.
i don't think you know anything about D
I know plenty about D; I read the website when slashdot put it up for the first time and again when you posted it.
and yes, it's faster and a better language than Haskell. pfft.
Care to backup such a statement? It's probably not faster: the only language faster than Haskell at the Sieve of Eratosthenes in the Shootout was C. Even C++ was slower. And it most certainly is not more elegant or more concise.
D has many more features than any other language
Hah! Disregarding the blatant inaccuracy of such a statement (if you want to compete in features, you'll probably never outdo Common Lisp), who said that language design was a competition to see who could pack in the most features?
and compiles the old-fashioned way.
As does Haskell. I'd prefer to argue against informed opinions in the future, thanks.
D is a copycat?
D has gone (and is going) nowhere that numerous other languages haven't already been. I'd say that defines a copycat.
That's like saying Java is a C++ copycat
Java is a C++ copycat. Gosling basically looked at C++ and took out the features that average programmers found confusing or error prone.
and that C++ was a C / SmallTalk copycat.
C++ took C and added the features of Simula 67 to it, not Smalltalk. The C/Smalltalk hybrid is Objective-C.
You, sir, have a higher ratio of opinionatedness to informedness than I have ever seen before. I've been accused of being opinionated before (an allegation that I don't deny in the least) but at least I have information and understanding to defend my opinions. You seem to possess neither.
Jeremy
jemfinch
02-08-2004, 08:27 PM
Originally posted by Strike
[B]It looks like D just tries to pack any old feature into it. What the heck are function delegates?
In Python-speak, they're bound methods. In FPL-speak, they're closures.
Basically, if you had a list L in Python, and you took L.append and "put it somewhere," you'd have a delegate.
Big freaking woop-de-doo is what I say.
Why the hell would you want to modify the arguments to a function?
Meh...C types (of people) are weird like that. They're accustomed to such things because manual memory allocation forces them to be. "out" types make little to no sense in a garbage collected language.
Why can't you use multiple inheritance?
Because (oh no!) programmers might make mistakes with it. Or because it makes writing the compiler harder.
Also, everything else in their little feature list is also in Python and Haskell, except for obvious things like no C-style syntax (which is a big minus, C syntax is far from natural or intuitive) and some of the more unimportant and random things that they have on the list.
If I went into every detail on that list that was incorrect, we'd be here for a long time. The list linked to is pure, disgusting, lying corporate marketing-speak.
Jeremy
JesusCyborg
02-09-2004, 03:54 AM
Care to backup such a statement? It's probably not faster: the only language faster than Haskell at the Sieve of Eratosthenes in the Shootout was C. Even C++ was slower. And it most certainly is not more elegant or more concise.
You either didn't look at the entire benchmark website or are just lying. On the scorecard page (http://www.bagley.org/~doug/shootout/craps.shtml) the Haskell compiler performed poorly in the end. The Sieve code was the only program Haskell did right. The Haskell COMPILER performed poorer than scripting languages like Perl and Python.
Haskell is fascinating, not practical. Haskell takes "high-level" programming way too far. Far enough that it becomes a blatent denial of reality or the manner in which computers process information. My philosophy is only take your language to a high enough level that you can understand it so you don't sacrafice practicality. No wonder Haskell compiles so poorly
Here is a quote from the Haskell website explaining why the language isn't really geared towards "speed"
"It isn't all roses, of course. The C quicksort uses an extremely ingenious technique, invented by Hoare, whereby it sorts the array in place; that is, without using any extra storage. As a result, it runs quickly, and in a small amount of memory. In contrast, the Haskell program allocates quite a lot of extra memory behind the scenes, and runs rather slower than the C program."
Java is a C++ copycat. Gosling basically looked at C++ and took out the features that average programmers found confusing or error prone.
You have a lot of gall to say that about Java. I don't think you understand or appreciate that there is more to a language than it's syntax. Java isn't an easier to use language, more scalable, and cleaner because it's C++ with multiple inheritance removed. It's better because there is a strict coding style/philosophy behind the syntax that is implemented the same in 99% of Java programs. With languages like C, Python, hell even D you can do whatever the hell you want. You can't with Java. This makes Java better than any other language for team development. That is why I hold it in such high esteem.
C++ took C and added the features of Simula 67 to it, not Smalltalk. The C/Smalltalk hybrid is Objective-C.
Well dude, you got me there. I thought smalltalk was pretty obscure but apparently c++ built itself off an even more obscure language. damn and i was pretty sure i read that out of a book too.
You, sir, have a higher ratio of opinionatedness to informedness than I have ever seen before.
So please please don't flame me this bad. I really hate getting in to flame wars. I don't hate you, and I'll respect YOU on these forums. (not necessarilly your opinions) Let's be a bit more civil because most of the time either of us won't be 100% correct.
p.s. Interfaces rock multiple inheritance
stuka
02-09-2004, 01:01 PM
Originally posted by JesusCyborg
You have a lot of gall to say that about Java. I don't think you understand or appreciate that there is more to a language than it's syntax. Java isn't an easier to use language, more scalable, and cleaner because it's C++ with multiple inheritance removed. It's better because there is a strict coding style/philosophy behind the syntax that is implemented the same in 99% of Java programs. With languages like C, Python, hell even D you can do whatever the hell you want. You can't with Java. This makes Java better than any other language for team development. That is why I hold it in such high esteem. So you're saying that just because 2 programmers/projects/whatever don't agree on coding standards published from "on high" (like Sun in the Java example) the LANGUAGE is worse?
p.s. Interfaces rock multiple inheritance All interfaces are, you know, are crippled versions of multiple inheritance. MI is not bad in itself - it's poor use of MI that causes problems.
Smerdyakov
02-09-2004, 01:09 PM
JesusCyborg, to help get this discussion back on track, could you give us a short paragraph explaining to us why you think we should use D? That sieve example is rather long, and by itself certainly encourages me _not_ to use D, as has been stated. But I'll assume that you have some valid reasons, and so I encourage you to share them. Yes, I see the links to information on D, but I'd like to read _your_ point of view.
GnuVince
02-09-2004, 01:18 PM
You either didn't look at the entire benchmark website or are just lying. On the scorecard page (http://www.bagley.org/~doug/shootout/craps.shtml) the Haskell compiler performed poorly in the end. The Sieve code was the only program Haskell did right. The Haskell COMPILER performed poorer than scripting languages like Perl and Python.
You can see that 5 of the tests were not implemented in Haskell, so that explains why it's lower in the final score than some interpreted languages. Just look at how poorly Stalin fared despite the fact that in the tests it was in, it was usually one of the fastest: 17 tests were not implemented!
Haskell is fascinating, not practical. Haskell takes "high-level" programming way too far. Far enough that it becomes a blatent denial of reality or the manner in which computers process information. My philosophy is only take your language to a high enough level that you can understand it so you don't sacrafice practicality. No wonder Haskell compiles so poorly
Look in the same shootout at O'Caml, CMUCL (Common Lisp), Bigloo (Scheme), smlnj (SML): they all are extremely high-level languages and they all fared extremely well. It's not because a language looks more like maths than like assembly that it is automatically slow.
Here is a quote from the Haskell website explaining why the language isn't really geared towards "speed"
"It isn't all roses, of course. The C quicksort uses an extremely ingenious technique, invented by Hoare, whereby it sorts the array in place; that is, without using any extra storage. As a result, it runs quickly, and in a small amount of memory. In contrast, the Haskell program allocates quite a lot of extra memory behind the scenes, and runs rather slower than the C program."
I think jemfinch explained in another thread that quicksort is fast if you change the array in place. That is why he suggests merge sort.
You have a lot of gall to say that about Java. I don't think you understand or appreciate that there is more to a language than it's syntax. Java isn't an easier to use language, more scalable, and cleaner because it's C++ with multiple inheritance removed. It's better because there is a strict coding style/philosophy behind the syntax that is implemented the same in 99% of Java programs. With languages like C, Python, hell even D you can do whatever the hell you want. You can't with Java. This makes Java better than any other language for team development. That is why I hold it in such high esteem.
You obviously don't know jemfinch: he LOVES multiple inheritance. It's a vital part of pretty much any object-oriented programming language, and it is important to reduce copy and pasting. I have heard that people in the Smalltalk community don't need it, so I don't know how they do it, but I do know that it is possible to implement multiple-inheritance yourself if you want, which is not possible in Java. Java's reflexion model sucks.
And doing whatever the hell we want is the single, most important aspect of a programming language! Can the language designer really know what I'm gonna want to do? Languages that give you total liberty, however bad they are (Forth, unlambda, bf, whitespace) do have an important quality over Java who is like a protective mother and prevents her children from doing certain things. I can see why in a big company this can be an advantage, but in pretty much every cases, this is just DisiplineAndBondage.
Well dude, you got me there. I thought smalltalk was pretty obscure but apparently c++ built itself off an even more obscure language. damn and i was pretty sure i read that out of a book too.
If you chekced Smalltalk and Objective-C, you'd see how these two are far more related than Smalltalk and C++. Smalltalk has a single inheritance model, while C++ has a multple inheritance model. Smalltalk is dynamically typed, C++ is statically typed. Methods in Smalltalk are keyworded, so they are, you might say, infix methods, while in C++ it's all prefix.
Example:
"Smalltalk"
1 to: 10 by: 2 do: [ "code" ].
// C++
myObject->method(arg1, arg2, arg3, arg4);
Also, Smalltalk is not obscure, these days, thanks to Squeak (www.squeak.org), it is well alive and kicking and many interesting projects are being done with it. It doesn't appeal much to *nix programmers though, because it's so different.
jemfinch
02-09-2004, 02:54 PM
Originally posted by JesusCyborg
You either didn't look at the entire benchmark website or are just lying.
Or you just don't understand how to read English. When someone says this:
Is that supposed to be somehow more elegant than this [link to Haskell implementation of the Sieve]? Because it certainly isn't faster.
"Faster" very obviously applies to the same thing as "this," "this" being the most recent subject to which to apply such an adjective. Don't call me a liar because you're unable to understand English.
On the scorecard page (http://www.bagley.org/~doug/shootout/craps.shtml) the Haskell compiler performed poorly in the end. The Sieve code was the only program Haskell did right. The Haskell COMPILER performed poorer than scripting languages like Perl and Python.
Only because certain tests were omitted for Haskell.
Haskell is fascinating, not practical.
That may be the case. I myself am not particularly a fan of Haskell, but given the choice between it and this "D" language Mr. Bright invented, I'll take it every day of the week and twice on Sunday.
Haskell takes "high-level" programming way too far.
That's impossible. Computer languages exist to abstract away details. You can complain that Haskell doesn't get too low, but no language ever be "too high level."
Far enough that it becomes a blatent denial of reality or the manner in which computers process information.
Aside from making no sense, your statement (if I interpret what you mean) is fundamentally wrong. Not all computation must be modelled by a von Neumann machine.
My philosophy is only take your language to a high enough level that you can understand it so you don't sacrafice practicality. No wonder Haskell compiles so poorly
You know nothing about Haskell.
Here is a quote from the Haskell website explaining why the language isn't really geared towards "speed"
No, your quote explains why a poor implementation of quicksort in Haskell is slower than a good implementation of quicksort in C.
You have a lot of gall to say that about Java.
No, actually, it doesn't take much. Gosling himself said in Java's original whitepaper that it was geared toward average programmers. That's why there's no preprocessor, that's why there are (were) no templates, and that's why there's no multiple inheritance.
I don't think you understand or appreciate that there is more to a language than it's syntax.
I think you're on crack, and I also think I have a much stronger basis for such a statement than you have for this one. Very few of my complaints have even been related to syntax.
Java isn't an easier to use language, more scalable, and cleaner because it's C++ with multiple inheritance removed.
Did I say that? No.
It's better because there is a strict coding style/philosophy behind the syntax that is implemented the same in 99% of Java programs.
Look who's focusing on syntax now. And no, that's not the reason Java is easier to program in. Garbage collection is. A consistent object model is. And yes, the lack of complicated features like templates and multiple inheritance and points are also reasons.
With languages like C, Python, hell even D you can do whatever the hell you want. You can't with Java.
Because features that might confuse average programmers have been removed.
This makes Java better than any other language for team development.
No, that makes Java better than any other language for hordes of average programmers to "develop" in.
That is why I hold it in such high esteem.
No, you hold it in such high esteem because you're a puppet for Sun's marketing department.
Well dude, you got me there. I thought smalltalk was pretty obscure but apparently c++ built itself off an even more obscure language. damn and i was pretty sure i read that out of a book too.
Well, you didn't.
So please please don't flame me this bad.
Why not? The majority of opinions you provide are completely unsupported; the few that you do defend are supported by invalid and ill-conceived ideas (not facts) that you likely got from some brochure.
Then again, I'm not flaming you. I'm correcting you, because you're fundamentally wrong. If you weren't wrong, I wouldn't correct you, and thus there would be no problem.
I really hate getting in to flame wars.
Then don't say stupid things.
I don't hate you,
Nor I you.
and I'll respect YOU on these forums. (not necessarilly your opinions)
I find it hard enough to respect you because of your offensive nick. But when I look past that, all I see are your ill-conceived opinions, profferred with little to no support.
Let's be a bit more civil because most of the time either of us won't be 100% correct.
No, and God knows I make mistakes too. But I'm rarely as 100% wrong as you are in this thread.
p.s. Interfaces rock multiple inheritance
P.S. No they don't. They're just easier to understand for average programmers.
Jeremy
Whiteknight
02-09-2004, 03:50 PM
i dont see anything new enough or cool enough to warrent my furthur study into D. If I got the option to go back in time, and learn my first language again, I might consider picking D over C, although i am plenty happy with the C/C++ i know now.
anybody, regardless of how bright they may be could write out their own language and compiler. all new languages are not necessarily better then old languages by virtue of their age. I plan to never learn java (or to forget it right after i learn it) and I dont think that I will learn any other algol-related languages from here on out, because the syntax sets are often too similar, and the results are most often less desireable then when implemented in C, which I already know.
D might be a good starting point for a newcomer, but if you already know C/C++, i wouldnt bother with it at all.
JesusCyborg
02-09-2004, 05:20 PM
Smerdyakov, thanks for trying to un hijack the thread but it's not happening today.
As for the rest: You're all a bunch of *******s.
GnuVince
02-09-2004, 05:25 PM
Who hijacked the thread? You talked about the D language and how you thought it was the best thing since sliced bread and a couple of us explained why we think it's nothing new or special.
By the way, does the truth hurt?
Strike
02-09-2004, 05:34 PM
The thread isn't hijacked, dude. Every post in this thread is either a directed response to another post in this thread (almost all of them yours which all mention D, the others are responses to posts that mention D), or it directly mentions D itself. The only posts that aren't like that are the ones following your claims of thread hijacking, like this one.
stuka
02-09-2004, 05:36 PM
Perhaps 'thread hijacking' means 'not agreeing with my opinion'?
Smerdyakov
02-09-2004, 07:11 PM
JesusCyborg, you're saying you won't answer my question because other people have upset you here?
jemfinch
02-09-2004, 09:57 PM
Originally posted by Whiteknight
i dont see anything new enough or cool enough to warrent my furthur study into D.
Good, neither do I.
I plan to never learn java (or to forget it right after i learn it) and I dont think that I will learn any other algol-related languages from here on out, because the syntax sets are often too similar, and the results are most often less desireable then when implemented in C, which I already know.
You're crazy if you think that you could implement a program in C anywhere nearly as fast as a good Java programmer can implement the same program in Java, or if you think that the resulting program would be as high quality. And I don't even like Java.
Jeremy
jemfinch
02-09-2004, 10:00 PM
Originally posted by Stuka
Perhaps 'thread hijacking' means 'not agreeing with my opinion'?
No, I think it actually means "I have no valid reply to the issues raised and thus I'll try to turn the tide against my opponents by associating them with some recently discussed offensive (to some) behavior that bears no relation to the thread at hand."
Jeremy
Smerdyakov
02-09-2004, 10:20 PM
jemfinch, you could be much more convincing in whatever you are arguing for if you avoided using such a negative tone and making useless negative remarks.
BillLeeLee
02-09-2004, 11:59 PM
Jem's very knowledgable on programming languages (very impressive, I only know a few people with the kind of knowledge he does). I won't disagree with the slighly negative tone, but he reminds me of someone from another forum I post at, except that person is a C++ fan.
jemfinch
02-10-2004, 01:51 AM
Originally posted by Smerdyakov
jemfinch, you could be much more convincing in whatever you are arguing for if you avoided using such a negative tone and making useless negative remarks.
I also wouldn't be so negative if people weren't so stupid all the time.
I doubt that my points would come across with people who at disagreement say things like "You're all *******s" regardless of how positive I made them seem.
Jeremy
Whiteknight
02-10-2004, 05:00 PM
Originally posted by jemfinch
You're crazy if you think that you could implement a program in C anywhere nearly as fast as a good Java programmer can implement the same program in Java, or if you think that the resulting program would be as high quality. And I don't even like Java.
Jeremy
no, thats not what i was talking about. i realize that writting java code can be a much quicker process, but i already know C (so it would take me a while to learn java) and C runs faster, and is more portable then java.
I'm talking about runtime, not development time, which is of utmost importance when you work primarily on old 386 or 486 processors, and old systems architectures like i do.
stuka
02-10-2004, 05:04 PM
C is more portable than Java? I sincerely doubt that. I'd wager that you'd be hard pressed to find a platform outside of the embedded processor market that didn't have a JVM (and some of them do, too), and I know for a fact that if you do ANYTHING system-wise, the C code would have to be (possibly heavily) modified, where the Java code might only need path name changes.
GnuVince
02-10-2004, 05:12 PM
Java's basic premise is "Write once, run anywhere". They aspire to be as cross-platform as possible. While languages like Python seem to do that better, Java no doubt does a better job than C.
jemfinch
02-11-2004, 12:40 AM
Originally posted by Whiteknight
I'm talking about runtime, not development time, which is of utmost importance when you work primarily on old 386 or 486 processors, and old systems architectures like i do.
If you really need the $20 it costs to buy a pentium these days, I'm sure we could take a collection.
Heck, why even bother with that? Quit programming for a day, go flip some some burgers, make $30, buy one (or may two!) pentium machines, and then write your software in Java (or Python, even). You'll save weeks of programming time!
Jeremy
Whiteknight
02-11-2004, 08:50 PM
but you miss my point entirely.
first off, i dont care about development time. i can spend weeks tinkering on a program because i dont program for a living, and it is just a thing i do in my spare time.
second, I dont go out and buy the machines. people give me their old boxes, and i convert them into usefull things, like web servers, routers, firewalls, entertainment centers, etc. and then either sell them for profit (actually a tidy income) or use them for my own needs (saves on hosting payments, or buying new equipment)
third, how long would it take me to learn java, considering i am a dyed-in-the-wool C programmer, and know only the rudiments of C++? well, i am taking a class in java next semester, so maybe i can start then. but i dont feel like cluttering my schedual trying to teach myself jave until then.
the final score is
me: 3
java: 0
Strike
02-11-2004, 11:21 PM
So your first argument is: I have all the time in the world, and your third argument is: I don't want have the time to learn something?
vBulletin® v3.7.0, Copyright ©2000-2010, Jelsoft Enterprises Ltd.