GPWiki.org
GPWiki.org
It is currently Sat May 25, 2013 1:03 am

All times are UTC




Post new topic Reply to topic  [ 17 posts ] 
Author Message
 Post subject: D
PostPosted: Wed Feb 14, 2007 5:12 am 
P2k
User avatar

Joined: Tue Aug 23, 2005 5:11 am
Posts: 2145
I've been experimenting with D. I've ported some C# code with very little difficulty (It's syntax is definitely influenced by C#). It was actually amazingly easy to port. I just had to change the case of some variables and make a few other small syntactic changes.

Anyone else used it?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 14, 2007 7:09 am 
Super Donkey Monkey Wrestler
User avatar

Joined: Mon Sep 13, 2004 9:44 pm
Posts: 978
Location: Orlando, Florida
if im not mistaken, i think D was out before c#, no?

_________________
from #gpwiki
<Sirisian_> there laugh at that
<Sirisian_> the fat one is cute
<Dial-Up> Quotes from Sirisian's prom.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 14, 2007 7:45 am 
Game Programming Guru

Joined: Thu Jun 08, 2006 7:48 pm
Posts: 1248
Location: Scotland
chemisus wrote:
if im not mistaken, i think D was out before c#, no?


I think so.

I'm an RAII fan so I see taking C++ but making it garbage collected as blasphemy. I klnow there's other differences too but it doesn't appeal very much as a language to me.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 14, 2007 8:15 am 
Double Guru
User avatar

Joined: Fri Aug 12, 2005 8:58 am
Posts: 2009
Location: LA, CA
D was one of the languages that I was considering to learn when I decided to break off from c++. It seems to be a revision of c++ that throws away a lot of the complexity and adds in features that more recent languages are heading towards (ie garbage collection). I ended up not learning it because it was too much like c++ and didn't seem to offer that much of an advantage.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 14, 2007 4:21 pm 
P2k
User avatar

Joined: Tue Aug 23, 2005 5:11 am
Posts: 2145
Yeah, it drops a lot of the bad features of C++. And is significantly easier to use from what little I have done so far. I think D is newer, 1.0 just came out recently (after C# 2.0).


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 14, 2007 6:13 pm 
13375p34k3r
User avatar

Joined: Tue Dec 06, 2005 3:54 pm
Posts: 1420
Location: A Nation inside a Nation.
I don't think D offers enough of an advantage for anyone to bother switching. People that like C++ will stick with C++, and if you want something different you'll either go to a C# or ruby or something else that's significantly different. More so than ever now that C++0x is coming up, which is likely to require that implementations provide optional garbage collection, among other enhancements.

Struan wrote:
Yeah, it drops a lot of the bad features of C++. And is significantly easier to use from what little I have done so far. I think D is newer, 1.0 just came out recently (after C# 2.0).

No, D is much older than C#. Remember, big vendors use 1.0 as the crappy first public version. Open source projects usually stick to 0.x until it's matured.

_________________
Hlade's Law: If you have a difficult task, give it to a lazy person -- they will find an easier way to do it.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 14, 2007 7:54 pm 
P2k
User avatar

Joined: Tue Aug 23, 2005 5:11 am
Posts: 2145
http://en.wikipedia.org/wiki/Timeline_o ... _languages

Lists C, C++, C#, and Java as predecessors of D.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 14, 2007 8:07 pm 
Bibliotherapist
User avatar

Joined: Wed Dec 21, 2005 6:23 pm
Posts: 6210
Location: Manchester, UK
I think http://en.wikipedia.org/wiki/Comparison_of_programming_languages has it more accurate, listing C#, Java, C and C++ as influences to D. I think D appeared just before C#, but the development of it has lasted several years now, so it would have taken some influence from C# as that has risen in popularity in that time period.

_________________
God must love stupid people, he made so many.
theraje: 'God doesn't love stupid people, they're just easier to make'
http://sharedillusions.blogspot.com


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 28, 2007 6:01 pm 
Prolific Poster

Joined: Wed Mar 28, 2007 4:56 pm
Posts: 15
Location: Poland
Seoushi wrote:
D was one of the languages that I was considering to learn when I decided to break off from c++. It seems to be a revision of c++ that throws away a lot of the complexity and adds in features that more recent languages are heading towards (ie garbage collection). I ended up not learning it because it was too much like c++ and didn't seem to offer that much of an advantage.


I think C# becomes more like continuation of C++, that tries to throw away much of its complexity


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 29, 2007 12:18 am 
13375p34k3r
User avatar

Joined: Tue Dec 06, 2005 3:54 pm
Posts: 1420
Location: A Nation inside a Nation.
lothar wrote:
I think C# becomes more like continuation of C++, that tries to throw away much of its complexity

C# is more like Java, just with some of the useful complexity from C++ put back :lol

_________________
Hlade's Law: If you have a difficult task, give it to a lazy person -- they will find an easier way to do it.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 17, 2007 12:27 am 
Game Programming Guru

Joined: Sun Aug 15, 2004 6:20 pm
Posts: 1090
Jamie wrote:
I'm an RAII fan so I see taking C++ but making it garbage collected as blasphemy. I klnow there's other differences too but it doesn't appeal very much as a language to me.

D has a keyword dedicated to RAII. Also, don't confuse garbage collection with RAII.

me22 wrote:
I don't think D offers enough of an advantage for anyone to bother switching.

It's lacking in libraries, but I've found it usable for game development. It fixes some of my gripes with C++, but adds other annoyances in the process.

Reasons not to switch:
1.) No real IDE for it yet. Codeblocks has a plugin for it, unfortunately it's no Visual Studio.
2.) The compiler makes some fat executables (270KB at least)
3.) There are multiple standard libraries for it floating around. This obviously causes problems if you're using the wrong one.
4.) The compiler doesn't always give very useful error messages. Can be very annoying. Errors are typically readable/comprhensible though
5.) Slightly worse performance than the usual C++ compilers
6.) Only has two compilers at the moment.
7.) D decided to take a weird approach to operator overloading. Coincidentally, I find it not as powerful/useful as C++'s.
8.) It's compiled to native code (unlike c#/java managed code). I decided to count this against D since, at least to me, having a JIT would be more useful. I have little knowledge of VM's and JIT, so perhaps this even a good thing :\

Reasons to switch from C++:
1.) Much faster compile times
2.) D is easier to parse than c++, and the parser for the DMD compiler is openly available. Because of this there's already a tool that compiles your application by parsing it and including all the needed libraries with a simple call like:
Code:
$ rebuild myfile.d

3.) Cleans up some of the dirty c++ syntax, but is still about the same (like Java/C#). Makes switching fairly painless.
4.) It's garbage collected by default, but you may continue to use pointers and such in the usual C way. Garbage collector may be disabled with extra work (why bother).
5.) Still pretty portable. DMD compiler has native windows and linux, and the gcc D compiler works for win/lin/mac I'm told (not sure how well).
6.) It has prettier template syntax than C++. Its templates arguably have more power behind them via some of the compile-time things the compiler lets you do.
7.) uses java-like modules/packages rather than the crappy #include stuff
8.) Misc useful additions: functions/classes defined inside functions, no more declaring classes/functions, array literals, and anonymous functions.

Everything said applied to D 1.0. D 2.0 is the next major update to the language that's in alpha stage now, containing more changes/additions that are certain to break backwards compatibility with D 1.0 :(

_________________
Heard in #gpwiki: <wzl> is there some serious grammar fail in your line or am i just too intelligent for your logic


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 25, 2008 7:56 am 
Prolific Poster

Joined: Fri Apr 25, 2008 7:37 am
Posts: 24
Quote:
Reasons not to switch:
1.) No real IDE for it yet. Codeblocks has a plugin for it, unfortunately it's no Visual Studio.
[/qute]
Well I personally am using enough different languages that I don't search for an IDE for each one anymore. I'm very happy with VIM. It has an awful learning curve, but its quite powerful. Depending on what you want, scite or so might also suffice.

Quote:
3.) There are multiple standard libraries for it floating around. This obviously causes problems if you're using the wrong one.

Currently there are "only" 2 (tango and phobos). And iirc there is something like tangobos which makes tango available on-top-of phobos.
But big ack, thats still a major annoyance.
Quote:
4.) The compiler doesn't always give very useful error messages. Can be very annoying. Errors are typically readable/comprhensible though

Can't confirm that one. I find it easier to understand the D error messages than I found it with C++
Quote:
5.) Slightly worse performance than the usual C++ compilers

Generally maybe yes. But as always with performance comparsions it depends. Also note that you can easily switch off the garbage collector for parts or your entire program and do manual collection like in C++.
This should equalize the performance if really every ns counts.
Quote:
6.) Only has two compilers at the moment.

Clearly D is neither as old as C++ nor is its community as large,
Maybe one should note that one of these two compilers is based on gcc, which makes it quite portable.
Quote:
7.) D decided to take a weird approach to operator overloading. Coincidentally, I find it not as powerful/useful as C++'s.

Could you be more specific? What exactly to you find weird or not as powerful?
Quote:
8.) It's compiled to native code (unlike c#/java managed code). I decided to count this against D since, at least to me, having a JIT would be more useful. I have little knowledge of VM's and JIT, so perhaps this even a good thing :\

You can't give a (-) for performance issues AND give a (-) for not being run in a VM ;) But seriously why should it be bad?

Quote:
3.) Cleans up some of the dirty c++ syntax, but is still about the same (like Java/C#). Makes switching fairly painless.

Its not so much about syntax issues. Its a lot behind the scenes that has been cleaned up. Just to give a few examples: Templates are really powerful AND understandable by humans in D. There is support for contract programming. It does not need this gruesome preprocessor stuff, nor is there a need to declare your classes in a .h file before you define them.
Quote:
4.) It's garbage collected by default, but you may continue to use pointers and such in the usual C way. Garbage collector may be disabled with extra work (why bother).

You can use pointers (and sometimes have to) also when the gc is on.
Note that disabling the gc is nothing more than 1 function call, so its really easy.

I'm really in love with D, and I was a real C++-Coder before. The development time is shorter and your Code is more readable. Due to the relatively small community it has not as much libraries as C++ has, but note that its no big deal to use any existing C-Library in D. I can only highly recommend to give it another try!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 25, 2008 9:22 pm 
Game Programming Guru

Joined: Sun Aug 15, 2004 6:20 pm
Posts: 1090
henning wrote:
Well I personally am using enough different languages that I don't search for an IDE for each one anymore. I'm very happy with VIM. It has an awful learning curve, but its quite powerful. Depending on what you want, scite or so might also suffice.

And I personally use gedit. Neither compare to the IDE's that C# and java have.

henning wrote:
You can't give a (-) for performance issues AND give a (-) for not being run in a VM Wink wink But seriously why should it be bad?

I see your point :P But it could be bad for not allowing runtime tricks like reflection that java/C# can do.

henning wrote:
Can't confirm that one. I find it easier to understand the D error messages than I found it with C++

This one has been hitting me lately pretty bad. Missing a '}' will tell you "UNEXPECTED EOF" or something, without a line number or any good indication of what the problem is. This is also true of certain cases with missing ';'. Also, template errors never provide enough information. They might tell me there's an error in the standard library file somewhere, but the error is actually where I'm using it in my own code. Can be VERY annoying with larger projects.

henning wrote:
Clearly D is neither as old as C++ nor is its community as large,
Maybe one should note that one of these two compilers is based on gcc, which makes it quite portable.

I have not tried GDC yet, and I should. I must have been thinking more about the lack of support and poorness of the DMD compiler when I wrote that. Thinking about it now, the number of compilers available for D isn't much of a negative considering there are two main compilers for C++, two main compilers for C#, and I'm sure not many more than two main compilers for java (I don't use java much). It's worth noting that D's DMD compiler gets regular updates, which I am very happy about.

henning wrote:
Could you be more specific? What exactly to you find weird or not as powerful?

They're named. Like "opAdd" rather than "operator+". It doesn't have as many overloadable operators as C++ (but the number of operators overloadable have grown since my post). And the lack of being able to pass references around means making hacks like opIndexAssign.


Some of my reasons didn't make much sense, since I may choose to compare speeds with only C++ and then compare certain features with C# rather than comparing it with each language. I should have just simply said that D is a nice mix of the languages, with comparable speeds to C++ yet having the nice high level features of java and C#. It may fall short in a few areas like all languages do, and it shines in others.

I love D too :) (but not the dmd compiler ;))

_________________
Heard in #gpwiki: <wzl> is there some serious grammar fail in your line or am i just too intelligent for your logic


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 26, 2008 1:21 pm 
Prolific Poster

Joined: Fri Apr 25, 2008 7:37 am
Posts: 24
Quote:
And I personally use gedit. Neither compare to the IDE's that C# and java have.

Agreed. But I personally don't need these fancy IDE-features. But if one needs them or not depends on a lot of factors, so maybe we shouldnt stress this topic too much

Quote:
I see your point :P But it could be bad for not allowing runtime tricks like reflection that java/C# can do.

I don't use such stuff much, but D today has as well runtime as compile time reflection stuff which I heard should be quite cool already.
(For example you can create objects at runtime by only knowing the class name, I used this for a serialization framework which reconstructed objects from a file)

Quote:
This one has been hitting me lately pretty bad. Missing a '}' will tell you "UNEXPECTED EOF" or something, without a line number or any good indication of what the problem is. This is also true of certain cases with missing ';'. Also, template errors never provide enough information. They might tell me there's an error in the standard library file somewhere, but the error is actually where I'm using it in my own code. Can be VERY annoying with larger projects.

Hmmkay. Missing/wrong linenumbers have been an issue to me too. But I tend to compile very often, so there isnt much Code that could have been the reason when I see an error message. Good syntax highlighting also makes finding { } problems very easy. At least in the case of a missing ';' I relatively quickly understood what gdc wanted to tell me. No idea if the quality of error messages is distinct on gdc vs. dmd, though.

Quote:
henning wrote:
Could you be more specific? What exactly to you find weird or not as powerful?

They're named. Like "opAdd" rather than "operator+". It doesn't have as many overloadable operators as C++ (but the number of operators overloadable have grown since my post). And the lack of being able to pass references around means making hacks like opIndexAssign.

Named: I would that count as a (+) because things like "operator()()" make it harder to write a parser/compiler because its an akward syntactic exception of the general rules. (Also I find it easier to read for humans). But agreed to your (-) that its not syntactilly obvious if you are really defining an operator.

I can't say much to the rest since I didn't use operator overloading so excessively yet (neither in C++ nor in D). But D class instances have always references so I'm not sure, what you mean with your last sentence.

Quote:
I love D too :) (but not the dmd compiler ;))

Same feeling as I have ;) I was forced to use gdc for a long time (because of a 64bit linux) and now I am developing the project in parallel on a 32bit windows machine with dmd and ran into one or two annoying things already.
(Note however that it took practically no time to port the code. Try that with C++, not even integer will be the same anymore!)

Meta:
Our posts are quite long and whe're discussing several issues at once, if there's more to it I suggest we somehow split things up and/or move elsewhere with it?

Henning


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 26, 2008 1:54 pm 
Dexterous Droid

Joined: Fri Aug 19, 2005 10:34 am
Posts: 3650
henning wrote:
Agreed. But I personally don't need these fancy IDE-features. But if one needs them or not depends on a lot of factors, so maybe we shouldnt stress this topic too much


Yeah, as long as there is a good IDE (as in functions well and can perform the IDE tasks that are actually necessary), the rest is mostly just about preference. I myself rely heavily on informative IDEs and intellisense just since I don't like to spend my time memorizing the whole .NET library instead of using it. But the .NET IDE is far from fast and light.

henning wrote:
I don't use such stuff much, but D today has as well runtime as compile time reflection stuff which I heard should be quite cool already.
(For example you can create objects at runtime by only knowing the class name, I used this for a serialization framework which reconstructed objects from a file)


But can you also generate a list of all the properties, methods, attributes, public fields, constructors, base class, interfaces, namespace, etc, invoke the methods, get their types, and get the types of their parameters? :ego

_________________
NetGore - Open source online RPG engine


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 26, 2008 4:49 pm 
Prolific Poster

Joined: Fri Apr 25, 2008 7:37 am
Posts: 24
Quote:
henning wrote:
I don't use such stuff much, but D today has as well runtime as compile time reflection stuff which I heard should be quite cool already.
(For example you can create objects at runtime by only knowing the class name, I used this for a serialization framework which reconstructed objects from a file)


But can you also generate a list of all the properties, methods, attributes, public fields, constructors, base class, interfaces, namespace, etc, invoke the methods, get their types, and get the types of their parameters? :ego

[/quote]
No, but as said I didn't miss it yet. There is some support for getting an overview over the classes, methods and members in the current module that's usually enogh for me. But as also mentions what one needs depends on many factors including (but not limited to): project size, language, structure and size of used (standard-) libraries, personal preference.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 29, 2008 3:50 pm 
Prime Example

Joined: Tue Apr 15, 2008 7:41 pm
Posts: 39
me22 wrote:
lothar wrote:
I think C# becomes more like continuation of C++, that tries to throw away much of its complexity

C# is more like Java, just with some of the useful complexity from C++ put back :lol

That was well said! :rofl Applause!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group