Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 14th, 2006, 5:10 PM   #31
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
That was a very interesting interview - I'll have to check D out properly sometime. I'm starting to see it as less of a "neatened-up C++" and more of a "performance-oriented Java/C#".
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Aug 14th, 2006, 5:18 PM   #32
AntiNinja
Hobbyist Programmer
 
AntiNinja's Avatar
 
Join Date: Jun 2006
Location: The States
Posts: 101
Rep Power: 3 AntiNinja is on a distinguished road
Send a message via AIM to AntiNinja Send a message via Yahoo to AntiNinja
I think this speaks for itself.

Found some docs, over here if anyone's interested.
__________________
Pain is just weakness leaving the body.
AntiNinja is offline   Reply With Quote
Old Aug 14th, 2006, 5:51 PM   #33
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
That's the comparison chart that helped me realise that. I took a look at it earlier - the last time I saw it, I hadn't really tried C# and so didn't understand what it was all about.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Aug 14th, 2006, 5:53 PM   #34
Random Spirit
Unverified User
 
Join Date: Aug 2006
Posts: 88
Rep Power: 0 Random Spirit is on a distinguished road
I like the way they got rid of multiple inheritace in D. That solves a hell of a headache. No more diamond inheirtance structure to worry about. yea!!!

Last edited by Random Spirit; Aug 14th, 2006 at 6:19 PM.
Random Spirit is offline   Reply With Quote
Old Aug 14th, 2006, 6:16 PM   #35
RemoteC2
Programmer
 
RemoteC2's Avatar
 
Join Date: Jan 2006
Posts: 55
Rep Power: 3 RemoteC2 is on a distinguished road
looks like they will have to put a new sectioin to this forum
RemoteC2 is offline   Reply With Quote
Old Aug 15th, 2006, 5:50 AM   #36
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Quote:
Originally Posted by Random Spirit
I like the way they got rid of multiple inheritace in D. That solves a hell of a headache. No more diamond inheirtance structure to worry about.
I can't say I've ever actually encountered this problem, despite working with languages that support multiple inheritance for a not insignificant amount of time. I can't quite see how this could be "a hell of a headache". A minor source of confusion at best, I fancy.
Arevos is offline   Reply With Quote
Old Aug 15th, 2006, 6:20 AM   #37
Random Spirit
Unverified User
 
Join Date: Aug 2006
Posts: 88
Rep Power: 0 Random Spirit is on a distinguished road
Quote:
Originally Posted by Arevos
I can't say I've ever actually encountered this problem, despite working with languages that support multiple inheritance for a not insignificant amount of time. I can't quite see how this could be "a hell of a headache". A minor source of confusion at best, I fancy.
Yeah, i was just being slightly sarcastic whilst being under the influence of some alcohol when i posted that comment. Its just i had to sit though a lecture once and then do some stupid problem in a practical session at uni that involved sorting out a multiple inheritance mess. I think it was to deter us from over using multiple inheritance in our code. I can remember being severly hungover when i had this practical session and so multiple inheritance always seems like a hell of a headache to me lol.
Random Spirit is offline   Reply With Quote
Old Aug 15th, 2006, 7:13 AM   #38
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Multiple inheritance can be quite useful - OGRE uses it, and it makes things easier.

Once you've got your head round it.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Sep 30th, 2006, 11:38 AM   #39
Jessehk
The Oblivious One
 
Jessehk's Avatar
 
Join Date: May 2005
Location: Ontario, Canada
Posts: 644
Rep Power: 4 Jessehk is on a distinguished road
Sorry to bring up an old thread, but I was just looking at D and it looks pretty neat. I always thought C++ would be around forever because there was nothing to replace it. I predict that in 5-10 years, that replacement language will be D.

Here's a sample (highlighted as C++):

cpp Syntax (Toggle Plain Text)
  1. import std.stdio;
  2.  
  3. /**
  4.  * Template function.
  5.  *
  6.  * Example: square!(int)( 3 );
  7.  */
  8. T square(T)( T val ) {
  9.  
  10. // if the debug level is >= 1,
  11. // this code will run.
  12. debug ( 1 ) {
  13. writefln( "In T square(T)( T val ): val is %s", val );
  14. }
  15.  
  16. return val * val;
  17. }
  18.  
  19. // unit tests for T square(T)( T val ) .
  20. // If these fail, the program will abort.
  21. unittest {
  22. // this will intentionally fail when compiled in
  23. // with -unittest
  24. assert( square!(int)( 3 ) == 8 );
  25. assert( square!(float)( 2.5 ) == 6.25 );
  26. }
  27.  
  28. // mark this function as deprecated.
  29. deprecated void foo() {
  30. writefln( "Foo!" );
  31. }
  32.  
  33. int main() {
  34. writefln( "%d", square!(int)( 10 ) );
  35.  
  36. foo();
  37.  
  38. return 0;
  39. }

A few compiles with some neat switches plus output:

$ dmd hello.d
hello.d(34): function hello.foo is deprecated

Add in a flag to allow deprecated functions...
$ dmd hello.d -d
gcc hello.o -o hello -m32 -lphobos -lpthread -lm
$ ./hello
100
Foo!

Add in a flag that compiles the unittests...
$ dmd hello.d -d -unittest
gcc hello.o -o hello -m32 -lphobos -lpthread -lm
$ ./hello
Error: AssertError Failure hello(24)

Add in the debug information, and fix the faulty test.
$ dmd hello.d -d -debug=2 -unittest
gcc hello.o -o hello -m32 -lphobos -lpthread -lm
$ ./hello
In T square(T)( T val ): val is 3
In T square(T)( T val ): val is 2.5
In T square(T)( T val ): val is 10
100
Foo!

I think it's pretty neat. :p

EDIT:, Oh, and it's fast too.
$ time ./hello
In T square(T)( T val ): val is 3
In T square(T)( T val ): val is 2.5
In T square(T)( T val ): val is 10
100
Foo!

real    0m0.001s
user    0m0.000s
sys     0m0.000s

EDIT2: and I know D isn't finished yet. All I'm saying is that when it is done, I think it will become popular.
__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS!

Last edited by Jessehk; Sep 30th, 2006 at 12:03 PM.
Jessehk is offline   Reply With Quote
Old Sep 30th, 2006, 9:04 PM   #40
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
How can you tell it's fast? A millisecond (real time) is slow for that, and smaller numbers show up as zero. You would need to run it a thousands of times for a meaningful timing picture.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The C programming Language (2nd Edition) nnxion Book Reviews 10 Jul 6th, 2007 3:29 PM
Which Programming Language for Beginner ? nkanthikiran Other Programming Languages 18 Jan 21st, 2006 5:53 PM
Best Programming Language to Use? gfunk999 C++ 22 Aug 2nd, 2005 11:59 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:46 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC