Slashdot Mirror


C, Objective-C, C++... D! Future Or failure?

TDRighteo writes "OSNews is carrying a quick introduction to a programming language under development - D. Features include garbage collection, overrideable operators, full C compatibility, native compilation, inline assembler, and in-built support for unit testing and "Design by Contract". With all the discussion about the future of GNOME with Java/Mono, does D offer hope of a middle-road? Check out the comparison sheet."

791 comments

  1. wow by spangineer · · Score: 5, Funny

    Who said computer geeks don't have any creativity in naming their programming languages?

    Oh, wait...

    1. Re:wow by slickepott · · Score: 3, Funny

      I think they still had some good choices with the C.. I have loads of cool signs on my number keys to play around with. *C, //C, &C, "C", /*C*/, C--, C+=1 Why the rush for D already?

    2. Re:wow by salimma · · Score: 1

      D's *THE* Programming Language :P. On a more serious note, once a stable release comes out targeting the GCC backend, it would be quite sweet to use with gtkmm/gnomemm...

      --
      Michel
      Fedora Project Contribut
    3. Re:wow by PacoTaco · · Score: 0, Offtopic

      C** gets my vote.

    4. Re:wow by 91degrees · · Score: 5, Insightful

      I'd like them to come up with a better name. D makes it very hard to find information about it on the web. A name like "zlxrt" would be better since it would get zero hits that weren't about the language.

      For the pedantic - I consider this post to be about the zlxrt language.

    5. Re:wow by rishistar · · Score: 5, Funny

      You guys are all behind the times. I'm already on E!

      Yeah - turn up that thumping music man!!!

      --
      Professor Karmadillo Songs of Science
    6. Re:wow by Inf0phreak · · Score: 1

      But... that's just C? Stupid operator algebra taking over my head...

      --
      ________
      Entranced by anime since late summer 2001 and loving it ^_^
    7. Re:wow by Laebshade · · Score: 1

      C stands for Cranky that the coders were, Objective-C stands for erronous as screams of programmers, C++ stands for the bus with the memory leaks, and D stands for the Death to the Dumbasses.

      The King is Dead! Long Live the King!

    8. Re:wow by oroshana · · Score: 1

      You mean Verisity's Specman Elite? I've been using that for a couple years now. The files are "E" files. It's pretty cool: Aspect oriented. Super neat. And of course it handles all the garbage collecting stuff.

    9. Re:wow by boredofthesane · · Score: 1

      Hmmm, if you're talking about grammar, C* would be any number of C's to infinity, or no c's. C* = Empty or C or CC or CCC or CCCC..... etc...
      Maybe that's what he meant....

    10. Re:wow by hackrobat · · Score: 1

      Well, this is why I think the name 'Fedora' rocks. Search for 'Red Hat' on Google and you get all sorts of junk and outdated info.

    11. Re:wow by Anonymous Coward · · Score: 0

      He's talking about math.

    12. Re:wow by twocents · · Score: 3, Funny

      Yes yes yes.

      Look for .Net in Google - the first result is php.net. That should offer a lesson for anyone.

    13. Re:wow by xSquaredAdmin · · Score: 2, Funny

      Well, the value of 'C'++ is 'D'. Looks like they're gonna need a new name (maybe... 'E'?)

      --
      Crushing dreams at the speed of sarcasm
    14. Re:wow by Keldian · · Score: 1

      That idea brings up a better idea.

      Why not just claim the next 3 letters and name it DEF.

      Or if that is still to hard to google for then call it DEF-G.

      The version after that could be called DEF+G

    15. Re:wow by ByteSlicer · · Score: 2, Funny

      Don't worry. In a while they will add some new extensions and call it D++.

    16. Re:wow by squiggleslash · · Score: 4, Informative

      Kind of sad really. If the inventors of this language had any sense of history they'd have called it "P" (Remember: there was no language called A, Ken Thompson's naming convention wasn't alphabetic, it was after BCPL, the language he was trying to improve upon.)

      --
      You are not alone. This is not normal. None of this is normal.
    17. Re:wow by randomblast · · Score: 1
      --
      ...these aren't my real teeth.
    18. Re:wow by Anonymous Coward · · Score: 0

      So.... you don't know how to search then do you? Instead of typing d. Type "D programming". Or "d foo()"

      get it?

    19. Re:wow by schapman · · Score: 2, Funny

      no... DEF-G and DEF+G will have to be two separate specs that arent compatible with each other at all. Then we can have big corps battle it out until the poor compilier makers have to write DEF+-G compilers for us.

      --
      Wouldnt you like to be a pepper too?
    20. Re:wow by Anonymous Coward · · Score: 0

      You don't know what you have until it's gone... gone... gone.

    21. Re:wow by llimllib · · Score: 4, Informative

      D's only link-compatible with vanilla C, so you'd need to create a GTKD wrapper, or just use regular old gtk.

    22. Re:wow by gunpowder · · Score: 3, Informative

      No, I think he meant this.

    23. Re:wow by kubrick · · Score: 1

      Woo-hoo! AmigaE! :)

      Loved it back in the day...

      --
      deus does not exist but if he does
    24. Re:wow by gwjgwj · · Score: 2, Funny

      The value of C++ is actually C. It is guaranteed to be C+1 after a sequence point.

    25. Re:wow by Anonymous Coward · · Score: 0

      You know, I heard the very same argument made about C++, back in the day...

    26. Re:wow by xSquaredAdmin · · Score: 1

      Fine. How's about ++'C'. That make ya happy?

      --
      Crushing dreams at the speed of sarcasm
    27. Re:wow by Anonymous Coward · · Score: 0

      C++ though is an equally good name to "P", as it's a tech joke. Though I find it a little ironic, the name leaves you with an unchanged result but it improves C. By rights, C ought to have been renamed to C++, and a new language known as C should have become the funky object oriented system...

    28. Re:wow by Anonymous Coward · · Score: 0

      Dee would have made more sense.

    29. Re:wow by Salsaman · · Score: 2, Funny
      I'm already on E!

      Shush ! They can arrest you for that, you know.

    30. Re:wow by CYwo1f · · Score: 1

      You mean this E?

    31. Re:wow by Anonymous Coward · · Score: 1, Funny

      Oh yeah? Well my language goes to 11!

    32. Re:wow by gauchopuro · · Score: 1
      You guys are all behind the times. I'm already on E!

      My languages are so advanced, they couldn't be referred to by letters from the English alphabet, so they use the Greek letter lambda. Give me Scheme or Haskell any day over C or D or whatever.

    33. Re:wow by Anonymous Coward · · Score: 0

      You should go hang yourself right now

    34. Re:wow by mrjb · · Score: 2, Funny

      Look for 'estupido' on google and the first hit is that of the Portuguese government.

      --
      Visit http://ringbreak.dnd.utwente.nl/~mrjb/growingbettersoftware to download your free copy of the book
    35. Re:wow by Anonymous Coward · · Score: 0

      Is that zee-one-ex-ar-tee or zee-el-ex-ar-tee?

    36. Re:wow by Tired+and+Emotional · · Score: 2, Interesting

      This is indeed the historical record - there was a language called just "B" which was based on BCPL and then C. So the next language after C++ should be --P. I believe BCPL stands for Basic CPL. CPL was Combined (sometimes Christopher's in honour of Christopher Strachey) Programming Language. In which case a subset implementation of the next language after C++ could be B--P.

      --
      Squirrel!
    37. Re:wow by pfafrich · · Score: 1

      But it would probably never get through a spam filter!

      --
      There are four sorts of people in the world: fools, lunatics, idiots and morons. - Umberto Eco, Foucaut's pendulum.
    38. Re:wow by WalterBright · · Score: 1

      I find that googling on "D programming language" or "programming language D" works well.

    39. Re:wow by 91degrees · · Score: 1

      Okay, but that's a workaround rather than a solution. I'm always grateful when people come up with slightly more abstract names to amke searching easier though. Even just 2 words bolted together makes it easier to get relevent hits.

    40. Re:wow by Soul-Burn666 · · Score: 1

      and the second one is sourceforge.net ;)

      --
      ^_^
    41. Re:wow by Jorkapp · · Score: 3, Informative

      Wikipedia: B Programming Language

      It was essentially BCPL stripped of anything Thompson felt he could do without, in order to fit it on very small computers, and with some changes to suit Thomson's tastes (mostly along the lines of reducing the number of non-whitespace characters in a typical program).
      ...
      According to Ken, B was greatly influenced by BCPL, but the name B had nothing to do with BCPL. B was in fact a revision of an earlier language, bon, named after Ken Thompson's wife, Bonnie.

      --
      Frink: Nice try floyd, but you were designed for scrubbing, and scrubbing is what you shall do.
    42. Re:wow by Mesaeus · · Score: 1

      Yes, but the number one hit would still be parent post. And the gazillion slashdotters proclaiming "zlxrt" to be a stupid name. Begin in 3..2..1..

    43. Re:wow by G33kDragon · · Score: 0

      Problem with that is that they can't. There is already a popular programming language called D++ at http://www.pagemac.com.

    44. Re:wow by salimma · · Score: 1

      You could also compile gtkmm under D with minor modification, and get the benefit of a more OO syntax, no?

      --
      Michel
      Fedora Project Contribut
    45. Re:wow by Anonymous Coward · · Score: 0

      How about Cb (C Flat)? Just to take the piss of course!

    46. Re:wow by saramakos · · Score: 1

      I thought when it increased in size it was called DD?

    47. Re:wow by John+Courtland · · Score: 1

      I believe he meant Ecstasy...

      --
      Slashdot is proof that Sturgeon's Law applies to mankind.
    48. Re:wow by brettper · · Score: 1

      Remember: there was no language called A
      How about Assembler?

    49. Re:wow by CryoPenguin · · Score: 1

      Or this e!

    50. Re:wow by Anonymous Coward · · Score: 0

      Yes, very popular.
      I'm sure everyone here has heard of it.

    51. Re:wow by sorbits · · Score: 1

      So instead of choosing a name that makes it clear that he thinks this is the successor to C, then he should select one that require no additional words to be entered in Google when searching for it?

      First hit with "D Programming" gave the language homepage... what is the difference between typing "D Programming" versus "DProgramming"?

    52. Re:wow by 91degrees · · Score: 1

      So instead of choosing a name that makes it clear that he thinks this is the successor to C, then he should select one that require no additional words to be entered in Google when searching for it?

      Yes. Why does it matter whether it's a successor to C or not? And does Dennis Richie agree?

      First hit with "D Programming" gave the language homepage... what is the difference between typing "D Programming" versus "DProgramming"?

      Because, if the language becomes popular, the homepage is the last place I'll be looking.

      If I just want general information about the language, I'll not search. I'll just go to the website. I'll be more likely to search for "how to do X using D". Will you ever be able to find information on 3D programming in D?

    53. Re:wow by g00dlife · · Score: 1

      Cb (C flat) = B back to the same problem!

  2. Microsoft will come out with it's own version by eclectus · · Score: 5, Funny

    Microsoft will come out with it own version, and call it D-.

    --
    This signature is a waste of 42 characters
    1. Re:Microsoft will come out with it's own version by e8johan · · Score: 0, Funny

      Nope, D#.

    2. Re:Microsoft will come out with it's own version by b4rtm4n · · Score: 5, Funny

      Visual D

      Cue loads of VD jokes :-D

      --
      "goatse? What's that? Anyone have a link?" - AC
    3. Re:Microsoft will come out with it's own version by Bronster · · Score: 1

      More likely Db, at which we'll realise that it's actually exactly the same C# near enough (unless you're playing an instrument that allows you to sharpen the Db a little more).

      Woot.

    4. Re:Microsoft will come out with it's own version by stevesliva · · Score: 4, Funny

      I was thinking Double-D.

      --
      Who do you get to be an expert to tell you something's not obvious? The least insightful person you can find? -J Roberts
    5. Re:Microsoft will come out with it's own version by Lord_Slepnir · · Score: 4, Funny

      Heck, I got enough of a kick out of Visual C (VC). Made me want to listen to acid rock and hunt Charlie.

    6. Re:Microsoft will come out with it's own version by wideBlueSkies · · Score: 1

      Please mod parent funny.

      I thought I was the only guy in the world who thought of the cong when someone referred to that product as VC.

      --
      Huh?
    7. Re:Microsoft will come out with it's own version by Anonymous Coward · · Score: 5, Funny

      You know why you can't get information on Visual C on the web? 'Cos Charlie don't surf.

    8. Re:Microsoft will come out with it's own version by Vampyre_Dark · · Score: 1

      Which happens to be short for my username, you insensitive clod!

    9. Re:Microsoft will come out with it's own version by jejones · · Score: 1

      No need. C# and Db are enharmonic, so they've already done it!

    10. Re:Microsoft will come out with it's own version by T-Kir · · Score: 3, Funny

      Or instead of sharp, use the hash orientation and you could have D-bong... mind you'd have to be on drugs to be able to use it though ;-)

      --
      Are you local? There's nothing for you here!
    11. Re:Microsoft will come out with it's own version by Paleomacus · · Score: 1

      And then VC++ or VCPP as I call it. The cong pee pee! Hee hee! Funnay!

    12. Re:Microsoft will come out with it's own version by Anonymous Coward · · Score: 0

      I was thinking Triple-D. Dolly Parton, come home to your Daddy. We have some sweet, sweet loving to make.

    13. Re:Microsoft will come out with it's own version by lacrymology.com · · Score: 2, Funny

      You know; whenever I startup Microsoft's IDE I get flashbacks, curl into a ball, and shiver. Now I see why.
      -m

      --

      #
      # Modus Ponens
      #
    14. Re:Microsoft will come out with it's own version by Anonymous Coward · · Score: 1, Funny

      Better than F+ which I once got from a bastard teacher. True.

    15. Re:Microsoft will come out with it's own version by hobuddy · · Score: 1

      That's one degree of suppuration. That's business with VD.NET.

      --
      Erlang.org: wow
    16. Re:Microsoft will come out with it's own version by red+floyd · · Score: 2, Funny

      I suppose you will need virus protection when using VD?

      --
      The only reason we have the rights we have is that people just like us died to gain those rights. -- Cheerio Boy
    17. Re:Microsoft will come out with it's own version by Anonymous Coward · · Score: 0

      Cue loads of VD jokes :-D

      And of course :-D would be the version from the DivX ;-) team.

    18. Re:Microsoft will come out with it's own version by Anonymous Coward · · Score: 0

      howabout Tenacious D?

    19. Re:Microsoft will come out with it's own version by Anonymous Coward · · Score: 0

      Then they will sue dolby for using the Double D logo that dolby labs has used for years. This is of course after the USPTO has granted them a trademark on it and ignored everybody elses ones

    20. Re:Microsoft will come out with it's own version by Eastree · · Score: 1

      VC? What about Microsoft's Visual D .... VD ... Venerial Disease? It kinda makes it seem a bit taboo ...

    21. Re:Microsoft will come out with it's own version by Anonymous Coward · · Score: 0

      Lisp... you can tell it's invented in the sixties because it has a hash-pipe operator.

    22. Re:Microsoft will come out with it's own version by Anonymous Coward · · Score: 0


      "Lisp... you can tell it's invented in the sixties because it has a hash-pipe operator."

      Except it was invented in the (late) 50's.

    23. Re:Microsoft will come out with it's own version by Old+Wolf · · Score: 1

      Well, they already came out with D flat

    24. Re:Microsoft will come out with it's own version by JamesTRexx · · Score: 1

      Yeah, but does that come from the cong, or because it's a Microsoft thing?

      --
      home
    25. Re:Microsoft will come out with it's own version by Anonymous Coward · · Score: 0
      Or, more likely,

      Microsoft Visual F-

      Maybe Billy Boy should go back to grade school, after all (hint, hint)

  3. full C compatability? by beegle · · Score: 4, Interesting

    I think the "full C compatability" is a problem. It's -not- a feature.

    In "small program" languages like perl, giving people lots of ways to do things is a feature. In a "large program" language, providing both C compatability and garbage collection is a maintainability nightmare. You'll have people who use both, or worse yet, who only understand one, so to understand the mixed code that results from a hybrid langage like this, you'll have to be utterly proficient with -both- languages.

    --
    --
    1. Re:full C compatability? by Anonymous Coward · · Score: 4, Insightful

      I don't know, I think objective-c handled it pretty well and clearly. It's a superset of c, and it's optional garbage collection is as simple as setting or not setting the auto-release flag when you construct your object.

      I wish the article actually compared to objective-c, as the story's poster seemed to imply...

    2. Re:full C compatability? by Elbows · · Score: 5, Informative

      Actually, the post was a bit misleading -- D only provides *link* compatibility with C. You can link to C libraries without any trouble, but you can't compile C source code in the D compiler.

    3. Re:full C compatability? by PhrostyMcByte · · Score: 4, Insightful

      Agreed. Though it's generally bad practice for libraries to allocate their own memory for returned data, it happens.

      Because it's not handled by D's garbage collection, it still needs to be freed. I'm sure this will make those developers who love to leak memory even worse.

    4. Re:full C compatability? by noselasd · · Score: 4, Insightful

      No. Its a very nice feature.
      Just about anything you need, there's a C library for it.
      Think nice things like opengl,pam,openssl,GUI librairies, database
      libraries, and heaps more.
      Having access to those is very nice, and you don't have to wait anyone
      to port those to a new language(which probably won't happen anyway.)
      I'd imagine how far C++ had gotten if it couldn't use C libraries..

    5. Re:full C compatability? by orthogonal · · Score: 5, Insightful
      In a "large program" language, providing both C compatibility and garbage collection is a maintainability nightmare.

      For those of us who don't like unpredictable...

      pauses...

      in our programs while the garbage collector does its work, will we be able to turn off garbage collection entirely or run the garbage collector only at specified times?


      I'll answer my own question: even if this is possible, if D ever becomes a serious language, we will be using libraries written by other people, libraries that do rely on garbage collection.

      So, no, we won't (realistically) be able to turn off the garbage collector, which means that we won't be able to write real-time programs, and it'll even be touchy writing programs, such as, oh, audio or video players, that require near real-time performance. (Not to mention the disappointment we all felt with the various java window-widget APIs (AWT, Swing) that looked great but couldn't run fast enough to respond to the mouse.)

      Look folks, taking care of your own garbage wasn't possible in C for a library writer (even ones returning opaque pointers to structs that allocated their own memory) because you had to rely on the library user to call your cleanup function(s).

      But the library user could clean-up. The problem was essentially that some programs didn't care enough to be careful -- pointers actually had to be tracked.

      Now, it's fine if a library user wants to add on a garbage collector by re-writing malloc to track allocations. But libraries, which are intended to be used by lots of programmers, to write code, and by lots and lots of end users who run code should not use garbage collectors themselves -- because that forces the library user to use garbage collection too.

      But in C++, library writers can write libraries that take care of their own garbage even when used by careless users, because the compiler will automatically call class destructors which can do clean-up. (Yes, except in the case of derived classes -- the writer of the derived class has to explicitly write a dtor to ensure the parent class dtor is called.)

      And in C++, with the Standard Template Library, there's little need for non-library writers to do explicit allocation at all -- std::vector and std::string and std::auto_ptr, just by themselves, take care of most of the problems of memory leaks and buffer overruns.

      If you're using C++ and you feel that you're a good enough programmer that there's real need for you to be calling

      new
      directly, them you're a good enough programmer to ensure that you've called
      delete
      for each new. And with std::auto_ptr, it's as easy as
      std::auto_ptr<foo> pfoo( new foo ) ;
      pfoo->do_Stuff() ;
      return ;
      // auto_ptr calls delete on pfoo, right here,
      // without you doing anything,
      // and without garbage collection overhead
      How much simpler does it need to be?

      So why complicate things with garbage collector and tracking down circular references and unpredictable pauses? Garbage collection is a bad answer for non-trivial programs, and pretty much necessary for trivial programs.
    6. Re:full C compatability? by Mr.+Piddle · · Score: 4, Insightful

      Though it's generally bad practice for libraries to allocate their own memory for returned data, it happens.

      It happens a lot. I've seen a few expensive C-based libraries that clearly show their designers struggled with the classic caller-callee allocation dillema and lost. Debugging memory leaks in programs that use these libraries is typically hopeless and requires high effort-versus-progress computationally-expensive run-time checks to find them. I like C quite a bit, but it is disheartening to see such a simple malloc() function cause so much pain.

      --
      Vote in November. You won't regret it.
    7. Re:full C compatability? by Haeleth · · Score: 3, Informative

      we won't (realistically) be able to turn off the garbage collector, which means that we won't be able to write real-time programs, and it'll even be touchy writing programs, such as, oh, audio or video players, that require near real-time performance. (Not to mention the disappointment we all felt with the various java window-widget APIs (AWT, Swing) that looked great but couldn't run fast enough to respond to the mouse.)

      Yeah, nice FUD. Java is slow because it's bytecode, not because it's garbage collected. (Incidentally, all the Swing applications I've used recently have been every bit as responsive as I could desire, so it isn't even necessarily slow.)

      So why complicate things with garbage collector and tracking down circular references...

      BOOM! And you reveal that you don't know what you're talking about. Circular references are irrelevant to any GC scheme more sophisticated than reference counting. They simply have nothing to do with it.

      I suggest you read this. Pay particular attention to the bits that explain things like "Modern garbage collectors appear to run as quickly as manual storage allocators (malloc/free or new/delete)," and "for very many applications modern garbage collectors provide pause times that are completely compatible with human interaction. Pause times below 1/10th of a second are often the case," and "Does garbage collection cause my program's execution to pause? Not necessarily.".

      Then come back and make some informed comments, instead of spouting nonsense. Thank you.

    8. Re:full C compatability? by PhrostyMcByte · · Score: 2, Informative

      std::auto_ptr is good but rather limited if you want to use the pointer in various locations at the same time. boost's shared_ptr is very nice for this.

    9. Re:full C compatability? by ballista · · Score: 2, Insightful

      So why not say it like it is: *Fortran* compatability, since that is what C was origionally designed to be compatible with. That way you could link with those pesky fortran math libraries.

    10. Re:full C compatability? by WWE-TicK · · Score: 3, Informative

      > Yes, except in the case of derived classes -- the
      > writer of the derived class has to explicitly
      > write a dtor to ensure the parent class dtor is
      > called.

      This is wrong. If your compiler requires this, then your compiler is broken.

      The destructor in a base class has to be made virtual though to ensure that correct destructors will be called if you do something like this:

      Base* o = new Derived();
      delete o;

      where Base is some class and Derived is derived from Base. If Base::~Base() is not virtual, then Derived::~Derived() would never get called.

    11. Re:full C compatability? by shadowpuppy · · Score: 1

      So?

      Register it with D's garbage collector and get on with life. It's fairly easy to do similar in C++. It should be easy in D.

      void
      foo() {
      MagicPointer<char *> p;

      p=strdup("The MagicPointer destructor will kill my copy");

      }

    12. Re:full C compatability? by RLW · · Score: 1

      Does that mean it is compatible with COBOL! Yeah, finally an update to the COBOL language. Woo Hoo. I love COBAL, I love COBOL, I love COBOL, I love COBOL, I love COBOL, I love COBOL, I love COBOL, I love COBOL.

      Well, not really but somebody had to stand for all the bankers and accountants out there, right?

    13. Re:full C compatability? by SphericalCrusher · · Score: 1

      I don't see how the two languages could be completely compatible with each other. I've never really seen a language that was -- even though Python and C++ really relates to each other, they aren't one in the same as one may think. Even C and C++ aren't close to the same language. But D? Hm. What more can you want? C++ pretty much gives us everything that we need so far. I don't think our technology is really far enough to need something else. Of course, I could be wrong...

      --
      "Instant gratification takes too long." - Carrie Fisher
    14. Re:full C compatability? by Darren+Winsper · · Score: 4, Insightful

      Err...he said real-time applications. Because the behaviour of a garbage collector is often approaching non-deterministic (You don't know when it will run or how long for), it's not acceptable for real-time systems. Real-Time Java gets around this by having other memory models which don't involve using the heap, along with providing types of threads that can run in parallel with the garbage collector.

    15. Re:full C compatability? by E_elven · · Score: 1

      The problem is you don't know how the garbage collector works. It may be expecting some data about the pointer that was stored when it was allocated. Same as with C++ -you should never mix new/delete and malloc/free.

      --
      Marxist evolution is just N generations away!
    16. Re:full C compatability? by orthogonal · · Score: 4, Informative

      BOOM! And you reveal that you don't know what you're talking about. Circular references are irrelevant to any GC scheme more sophisticated than reference counting.

      My point was that to avoid the problem of circular references, the garbage collector does have to be more sophisticated, and sophistication takes time and (memory) space -- time and space that a program may or may not be able to spare.

      "for very many applications modern garbage collectors provide pause times that are completely compatible with human interaction. Pause times below 1/10th of a second are often the case,"

      Pause times below 1/10th of a second? Hmm, how much below? TV-quality video is 24 frames per second, so a one-tenth second pause means dropping two or three frames. Acceptable? Perhaps, but not desirable.

      "Does garbage collection cause my program's execution to pause? Not necessarily."

      Yes, if you read my post carefully -- perhaps you missed a word or two when the garbage collector in your head did some clean-up -- I didn't say that pauses were inevitable. My complaint -- and not just mine, it's no revelation that garbage collection has may detractors -- is that the pauses are not predictable by writer of the program.

      With non-garbage collected language, I know that memory allocation will either succeed ort fail, and I know (or a library writer knew) when allocation happens, because I'm explicitly coding it. So I know, at this particular point in my program, either allocation succeeded or failed.

      But garbage collection can happen at any time, and cause a pause at any point in my program -- even when I'm needing to re-fill under-run buffers or read volatile memory or make time-critical choices. With garbage collection, I no longer have an algorithmic program, in which I can say what it's doing at any particular point in the code.

      Then come back and make some informed comments, instead of spouting nonsense. Thank you.

      That overly hostile arrogance suggests you're either a zealot or a fourteen year-old. That sort of blustering generally indicates someone who isn't that confident in himself or his argument, and so wishes to preempt questioning by being a posturing like a "tough guy"; it's particularly prevalent on the net -- though I'll grant that you didn't hide behind an Anonymous Coward post. Adults can disagree and discuss things without resorting to insults and attitude -- and I think you'll be able to do that too, with a little more experience.

    17. Re:full C compatability? by elhaf · · Score: 2, Insightful

      Um, auto_ptr/reference counting is a form of garbage collection, just not a very good one. The trivial example given is certainly fine, but why not just put pfoo on the stack if it's that trivial. Reference counting has problems with circular references; most other garbage collection schemes do not. Note: any doubly-linked list or both-way parent-child relationship is circular.

      There is overhead to auto_ptr; In the statement pfoo->do_Stuff(), the -> is an overloaded operator, requiring a function call. The implied destructor is also a function call. In the gc world, there are far better schemes than mark/sweep, which is the other one that most people think of when talking about gc. Incremental and concurrent gc is feasible.
      Also, new and delete aren't free, by the way; they do things that aren't strictly necessary in a gc environment. Reference counting (smart pointers)has overhead at every assignment/function call, whereas most gc has far better overhead performance, especially for long-lived data. The argument that gc is too expensive holds little water.

      --
      Six score characters.
      Brevity being wit's soul
      I have enough space.
    18. Re:full C compatability? by TDRighteo · · Score: 1

      Um, yeah, you're absolutely right. The OSNews phrase "D programs can import and link against C code and libraries" was a bit fuzzy, and my quick reading didn't pick up the distiction. To be quite honest, I wasn't really interested in the extent of C compatibility when I posted. Can you use your C libraries with D? Yes - to an extent. The in-built unit testing features are the parts I think are most useful. That, and support for the CONCEPTS of C et al. And garbage collection. All the things you need to lure C & C++ programmers to a new language. It's not the first time or the last time that somebody has made a mistake on Slashdot though. And IMHO, this one's pretty minor compared to some!

    19. Re:full C compatability? by MartinG · · Score: 2, Insightful

      Pause times below 1/10th of a second are often the case,

      That's not even remotely low enough for realtime audio applications. "Human interaction" includes realtime mixing of audio streams etc, not just displaying windows and moving a mouse pointer.

      Yeah, nice FUD. Java is slow because it's bytecode

      Bytecode is not slow if its jit compiled. Java can be as fast as compiled c in some cases where the jit engine has done a good job. That doesn't reduce GC latency though.

      --
      -- MartinG To mail me: echo kewyjlcxyzvjfxbqwh | tr bcefhjklqvwxyz .@adgimnoprstu
    20. Re:full C compatability? by orthogonal · · Score: 1

      This is wrong. If your compiler requires this, then your compiler is broken.

      No, you're correct. It was me, not the compiler that was broken. Thanks for the correction.

    21. Re:full C compatability? by iamacat · · Score: 1
      But in C++, library writers can write libraries that take care of their own garbage even when used by careless users, because the compiler will automatically call class destructors which can do clean-up. (Yes, except in the case of derived classes -- the writer of the derived class has to explicitly write a dtor to ensure the parent class dtor is called).

      Huh? C++ always calls parent/member destructors implicitely. What you may need to do is to declare parent destructor as virtual.
      std::auto_ptr<foo> pfoo( new foo ) ;
      &#160; pfoo->do_Stuff() ;
      &#160; return ;
      This is a bad example of auto_ptr, as you could just allocate foo on stack. At least give something with an if statement that calls different constructors.

      So why complicate things with garbage collector and tracking down circular references and unpredictable pauses? Garbage collection is a bad answer for non-trivial programs, and pretty much necessary for trivial programs.

      Non-trivial programs tend to call hundreds of trivial libraries, which in turn are likely to have much better feature set, robustness and in some cases performance (shared structures vs copy) than if garbage collection was not available.
    22. Re:full C compatability? by Anonymous Coward · · Score: 0

      You do know you're not suppose to put a std::auto_ptr in an STL collection, right?

    23. Re:full C compatability? by rblum · · Score: 3, Insightful

      Yes, he said real time. Big deal. If he actually was informed about the topic, he'd know there are several GCs that are useable for *hard* realtime. They have *guaranteed* response times.

      Sorry - the whole "GC is slow" is a myth, unless you implement a naive GC. But guess what - naive memory allocation by hand can kill performance, too. (It's not like malloc is a speed demon, after all...)

    24. Re:full C compatability? by swillden · · Score: 2, Insightful

      It's not like malloc is a speed demon, after all...

      Malloc's usually pretty good, it's the performance of free that typically sucks. It all depends on the implementation, of course.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    25. Re:full C compatability? by Camel+Pilot · · Score: 1

      That overly hostile arrogance suggests you're either a zealot or a fourteen year-old. That sort of blustering generally indicates someone who isn't that confident in himself or his argument, and so wishes to preempt questioning by being a posturing like a "tough guy"; it's particularly prevalent on the net ... Adults can disagree and discuss things without resorting to insults and attitude -- and I think you'll be able to do that too, with a little more experience.

      Nicely put! What is it about the net that prompts people to come off as complete jerks when they would never interact in such a way on a person-to-person basis.

    26. Re:full C compatability? by Darren+Winsper · · Score: 1

      non-deterministic != slow, just unpredictable. The use of garbage collectors in real-time systems isn't typically considered. Having said that, I guess you could consider RTJ's scoped memory a form of GC.

    27. Re:full C compatability? by at2000 · · Score: 3, Informative
      No! It is call-compatible only.
      D programs can import and link against C code and libraries, providing D with free access to a huge amount of pre-written code. Note, however, that D is not link-compatible with C++, so pure C wrappers are required to access C++ code in D.
    28. Re:full C compatability? by red+floyd · · Score: 1

      Yes, except in the case of derived classes -- the writer of the derived class has to explicitly write a dtor to ensure the parent class dtor is called.

      Huh? If the parent declares a virtual dtor, the proper destructor sequence will always be called, regardless of destruction method. If the child isn't destroyed thorugh a base class pointer, but dies from either a delete pChild or by going out of scope, you don't even need that. The compiler will ensure that the base class dtor gets called.

      --
      The only reason we have the rights we have is that people just like us died to gain those rights. -- Cheerio Boy
    29. Re:full C compatability? by kahei · · Score: 1

      Yeah, nice FUD. Java is slow because it's bytecode, not because it's garbage collected. (Incidentally, all the Swing applications I've used recently have been every bit as responsive as I could desire, so it isn't even necessarily slow.)

      Java is slow for many reasons -- bytecode need not be slow. The Java GC is slow, and some of the Java libs are slow (j3d anyone?), and there are aspects of Java bytecode that make it difficult to optimize (it was designed to be interpreted, remember), but there is no reason why bytecode must be slow.

      Swing is very slow. I don't know _what_ kind of machine you must be using swing on.

      BOOM! And you reveal that you don't know what you're talking about. Circular references are irrelevant to any GC scheme more sophisticated than reference counting.

      But still relevant to Java, unfortunately. I agree, though, that GCs need not cause pauses -- it's just that common Java ones do (I don't know if this is just an implementation thing or a subtle property of Java, though).

      Then come back and make some informed comments, instead of spouting nonsense. Thank you.


      Mm. Quite.

      --
      Whence? Hence. Whither? Thither.
    30. Re:full C compatability? by Anonymous Coward · · Score: 0

      Why is it when GPL'd code is alleged to be re-used commercially, and clearly outside the terms of the GPL, it works flawlessly?

      However, when a new "fully backward compatible" language (and consequently new code) alleges that legacy libraries and code will work with everything, it doesn't have a hope in hell?

      Will GPL'd "D" code be somehow more robust?

    31. Re:full C compatability? by Anonymous Coward · · Score: 0

      Of course, I could be wrong...

      That seems like a fair bet.

    32. Re:full C compatability? by scotch · · Score: 1
      There is overhead to auto_ptr; In the statement pfoo->do_Stuff(), the -> is an overloaded operator, requiring a function call.

      -> is an overloaded operator, but as the function definition is trivial and it is declared inline, the function call will be compiled out in an optimized build yielding code that is no more expensive than the pointer indirection. The same applies to the destructor: true it's a function call, but in practice, std::auto_ptr::~auto_ptr () will simply be replaced by "delete Foo;" in an optimized build.

      --
      XML causes global warming.
    33. Re:full C compatability? by be-fan · · Score: 3, Interesting

      Malloc is still ridiculously expensive compared compared to what a generational GC can do. A malloc is dozens to hundreds of instructions, while in many cases (eg: when you're following the typical functional-language allocation patterns), a generational GC can alloc in just a few instructions. And while the GC phase itself is hardly speedy, the amortized cost of the GC is much lower than the non-amortized cost of doing all those free()'s individually.

      --
      A deep unwavering belief is a sure sign you're missing something...
    34. Re:full C compatability? by be-fan · · Score: 4, Informative

      My point was that to avoid the problem of circular references, the garbage collector does have to be more sophisticated
      No it doesn't. Handling of circuler references falls naturally out of most GC algorithms. One of the simplest possible memory algorithms is the mark & compact GC, which handles circuler references naturally.

      Pause times below 1/10th of a second? Hmm, how much below? TV-quality video is 24 frames per second, so a one-tenth second pause means dropping two or three frames.
      You disable the GC in those cases. A good GC will give you the option to manually manage memory in certain cases (say, through a pool allocator), so in any time-sensitive paths, you can disable the GC and rely on those other options. There are also real-time GC's that have absolutely bounded pause times.

      But garbage collection can happen at any time, and cause a pause at any point in my program -- even when I'm needing to re-fill under-run buffers or read volatile memory or make time-critical choices.
      You do realize that you have this issue with any modern OS? A malloc() can take tens of thousands of clock-cycles if it decides to mmap() to get more backing memory, and the kernel decides to block the app.

      --
      A deep unwavering belief is a sure sign you're missing something...
    35. Re:full C compatability? by ThrasherTT · · Score: 1

      And how exactly does the GC system deal with pointers returned from the C libs? Seems to me that the OP hit the nail on the head. If you can link to "unmanaged" code, you'll need to know how to deal with GC issues as well as free-for-all memory management.

      --

      All Your Memory Are Belong To Java
    36. Re:full C compatability? by swillden · · Score: 1

      All very true.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    37. Re:full C compatability? by sir99 · · Score: 1
      auto_ptr doesn't do reference counting. It maintains the invariant that only one instance of auto_ptr owns the pointer, by transferring ownership on each assignment. When the owning copy goes out of scope, the pointer is freed. The only run-time overhead should be a few pointer assignments.

      Those function calls you mention are templates; they compile away to nothing more than the equivalent operations on a pointer.

      --
      The ocean parts and the meteors come down
      Laid out in amber, baby.
    38. Re:full C compatability? by be-fan · · Score: 1

      On a related note. There are languages other than Java that use GC's. Dylan comes to mind. Dylan-Win32 apps are indistinguishable from C/C++ Win32 apps when it comes to performance. The GC's pause times are so short you just don't notice them. I hear OCaml's GC is extremely good as well.

      --
      A deep unwavering belief is a sure sign you're missing something...
    39. Re:full C compatability? by urmensch · · Score: 1

      Here ya go.

    40. Re:full C compatability? by shadowpuppy · · Score: 1

      The idea is that the object you wrap around the pointer does know. It may require more work to get it to but that can be done. The garbage collector only knows about your wrapper object. So when that's deleted, its destructor cleans up the non-conformist bits.

      The C++ version tends to have a few ugly bits since some C++ implimentations don't allow mixing of new/delete and malloc/free. However it's still prettier than the alternatives. Also a new language and can just mandate that they be interchangeable for non-objects.

    41. Re:full C compatability? by iabervon · · Score: 4, Interesting

      An afternoon with Valgrind should track down most of these without too much effort. It's really gotten to be a nice "please tell me what's wrong with my program" tool, capable of letting you send in bug reports like "function X leaks a 20-byte chunk of memory and a 4-byte chunk every time I call it with these arguments." For now you can't determine things like "bytes 16-19 of the leaked chunk are a pointer to a filename", but I suspect that will be in a later version (determined by what system calls are called with it).

      One thing I'd really like to see in Java is Object.free(), which would tell the garbage collector that the object is garbage and can be freed, and cause any further use of the object to throw a FreedMemoryException. This would be useful both as a hint to the system (letting it get rid of things the object references early) and as a debugging aid (so you can find cases where stuff remains in use after you don't think it will). Of course, it violates Java's sandbox design to have a C-style free() which recycles the address space.

    42. Re:full C compatability? by metamatic · · Score: 1

      The problem is, it may be bad practice for libraries to allocate their own memory for returned data, but it's also bad practice for libraries to have fixed size returned data, particularly when dealing with IO. There's a reason why C programs have so many buffer overflow problems and Y2K-like error conditions.

      (From which many sensible people conclude that it's bad practice to write in C.)

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    43. Re:full C compatability? by metamatic · · Score: 2, Insightful

      So, no, we won't (realistically) be able to turn off the garbage collector, which means that we won't be able to write real-time programs, and it'll even be touchy writing programs, such as, oh, audio or video players, that require near real-time performance

      Ah, the eternal anti-GC FUD of the ignorant.

      Yes, clearly it would be complete lunacy to write video games in garbage-collected LISP, like Jak and Daxter, Ratchet and Clank and so on.

      Obviously AT&T were insane to write their telephone exchange control software in garbage collected LISP.

      And those massive overheads ensure that we'll never see NASA using LISP to control space probes.

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    44. Re:full C compatability? by emarkp · · Score: 2, Interesting
      I think the "full C compatability" is a problem. It's -not- a feature.
      Actually it's both. C compatibility leads to early and widespread adoption, but it also carries tons of baggage--at least that's been the case in C++.

      One of the biggest problems in C++ is backwards-compatibility with integer promotion rules. It appears to cause more confusion than templates and name lookup combined.

    45. Re:full C compatability? by Anonymous Coward · · Score: 0

      They don't compile away to nothing because they are templates. They compile away to nothing, if they do, because they are inline functions. Templates have nothing to do with it.

    46. Re:full C compatability? by Chester+K · · Score: 2, Funny

      Yes, if you read my post carefully -- perhaps you missed a word or two when the garbage collector in your head did some clean-up -- I didn't say that pauses were inevitable. My complaint -- and not just mine, it's no revelation that garbage collection has may detractors -- is that the pauses are not predictable by writer of the program.

      There are an awful lot of dashes at random places in this paragraph. Were you by chance running garbage collection?

      --

      NO CARRIER
    47. Re:full C compatability? by Build6 · · Score: 1

      There needs to be a +1, Polite mod option.

      Well done.

    48. Re:full C compatability? by iabervon · · Score: 1

      There are now multi-threaded garbage collectors which never pause. The GC runs in a separate thread tracking which objects have not been referenced recently and collecting ones which haven't been referenced during the time the whole heap was scanned (in much the same way that cache eviction algorithms work). It parallelizes nicely out of the program's normal operation (for the simple reason that things that are garbage aren't used by the program). On allocation, it can be made to work or fail immediately, if desired. With multiple threads, the allocating thread can block on garbage collection finding more space while other threads (which are not allocating anything) run unhindered.

      Modern garbage collection is not really any slower than modern virtual memory with swap, and doesn't really make things any less predictable than swap does. It's not all that different, except that it determines memory that's especially stale, and discards it entirely.

    49. Re:full C compatability? by bugnuts · · Score: 1

      No... you're thinking of the new language, DOBOL.

    50. Re:full C compatability? by cheezit · · Score: 1

      I always wonder why anyone worries about the tiny incremental hit of function calls/vtable lookups in C++. If the application is so speed- or realtime-oriented that you can't afford having the compiler do some work for you, then write it in C...maybe throw in some C++-style patterns (typedef'd void pointers, etc) to help the compiler a bit. If the application requirements aren't that stringent, relax, use GC if you can, run the compiler, and think of England.

      If you need to know *exactly* what the compiler will do, you might as well have include the compiler code as part of your project. After all, if someone changes the compiler behavior, or if your compiler doesn't implement the spec perfectly, then you are hosed up.

      --
      Premature optimization is the root of all evil
    51. Re:full C compatability? by Igmuth · · Score: 1
      But garbage collection can happen at any time, and cause a pause at any point in my program -- even when I'm needing to re-fill under-run buffers or read volatile memory or make time-critical choices.
      You do realize that you have this issue with any modern OS? A malloc() can take tens of thousands of clock-cycles if it decides to mmap() to get more backing memory, and the kernel decides to block the app.
      Yes, But the difference in that case is that malloc happens at a known point. You can intentionally place such actions in non-time critical sections of your program. The problem the OP was refering to is that with garbage collection, the garbage collection could occur during a time-cirtical section. Something which you as a programmer could avoid otherwise.
    52. Re:full C compatability? by Mad+Bad+Rabbit · · Score: 1
      My complaint -- and not just mine, it's no revelation that garbage collection has may detractors -- is that the pauses are not predictable by writer of the program.

      If your application has realtime performance requirements, you should disable garbage collection AND you probably shouldn't be using third-party libraries unless you've reviewed all their source code. Not only might they depend on GC, they might introduce their own unpredictable pauses: i.e. "if (key[N] < key[N+1]) { do-crappy-bubblesort(); }".

      But for the majority of applications, which don't have such strict realtime requirements, GC will help prevent a lot of memory leaks, dangling pointer crashes, and buffer overruns (caused by developers using fixed-size buffers when they ought to be allocating dynamically).

      --
      >;k
    53. Re:full C compatability? by elhaf · · Score: 1

      Yes, but the equivalent operations are as follows:
      //precondition: x has pointer, y has other pointer
      y = x;
      //postcondition: y has pointer, x is 0, other pointer is freed
      There is a lot of implicit code, such as assignment of x=0 there every time you do an assignment. So inline or not, there is overhead compared to:
      //precondition: x has pointer, y has other pointer
      y = x;
      //postcondition: x and y have pointer, other pointer is garbage to be dealt with later
      The latter is fine for most garbage collection schemes; the saved overhead of x=0, etc. is amortized across the garbage collection overhead.
      Additionally, garbage collection solves far more problems than invariably having only one pointer to any object. Double-linked lists come to mind again, where I want a->b and b->a. In the list a,b,c, c and a both point to b.

      --
      Six score characters.
      Brevity being wit's soul
      I have enough space.
    54. Re:full C compatability? by pommiekiwifruit · · Score: 1
      TV-quality video is 24 frames per second

      Just to agree with you - IIRC film is 24 and really sucks when it pans around a wide landscape, NTSC VHS is 30, PAL VHS is 25 and broadcast/modern consoles is double that. For a PC 85 fps is comfortable for me... Apparently for haptic interfaces 500Hz is required.

      I remember using Prolog on the mac and it had garbage collection - you could wait for 10 seconds or more for it to do its thing. Ditto for C64 BASIC. Windows sometimes feels like it is doing the same thing when it pauses the machine and randomly whirrs the disk...

      And non deterministic programs are harder to debug than explicitly coded (single threaded) ones anyway.

    55. Re:full C compatability? by Anonymous Coward · · Score: 2, Informative

      try this...
      object = NULL;
      System.gc();

      although you shouldn't really call System.gc yourself. Also, object = NULL would do the same thing as object.free() since you don't actually want to free the memory right now, but instead tell the JVM that it should be free'd in the future. Inline memory free'ing is only necessary in embedded apps that are written in C anyway. BTW, valgrind rocks. I used it to trim a version of Doom from 16MB to under 4 with all textures. This allowed me to get it running on very small hand held devicies.

    56. Re:full C compatability? by tyrecius · · Score: 1

      The trivial example given is certainly fine, but why not just put pfoo on the stack if it's that trivial. Reference counting has problems with circular references; most other garbage collection schemes do not. Note: any doubly-linked list or both-way parent-child relationship is circular.

      This is just silly. First of all, quite a bit of dynamic memory allocation is 0/1. You need 0 of them or you need 1 of them. In such a case, auto_ptr is great.

      Second, though there are certainly cases in which auto_ptr is not suited, your examples don't hold water. In both doubly-linked lists and tree structures, one uses an auto_ptr as an owner to your eldest child and a normal pointer as a handle to your parent. Likewise, in a linked list, the auto_ptr points forward and a handle points back.

      A case where auto_ptr's are completely inadequate is in a data structure representing a vertex in a generalized graph.

      There are limits to any tool, but a hammer is still useful even if it cannot chop wood.

      --
      char a[]="lbiitgt l e \n\n\0";main(){for(char*c=a; *(short*)c;c+=2){putchar(*(short*)c);}}
    57. Re:full C compatability? by elhaf · · Score: 1
      I always wonder why anyone worries about the tiny incremental hit of function calls/vtable lookups in C++.
      Well, I hope other compiler-writers like myself do ;-)
      --
      Six score characters.
      Brevity being wit's soul
      I have enough space.
    58. Re:full C compatability? by cheezit · · Score: 1

      Okay, sure...*you* get a pass. :)

      --
      Premature optimization is the root of all evil
    59. Re:full C compatability? by elhaf · · Score: 1

      There is overhead, even if a good programmer can work to minimize it. There are also cases where any given inferior garbage collection scheme like auto_ptr or smart pointers/reference counting fails. A good garbage collection scheme will create generations for short-term 0/1 data like this and longer term data, and handle it automatically. The overhead accumulated by all the auto_ptr assignments and such will be in general amortized to the garbage collection. But, garbage collection is much simpler to use. Code is not obfuscated with housekeeping syntax and semantics. No pointers have to be treated specially; no programming resources are wasted deciding whether something should be "special" or not (owner or not, forward vs. backward in your examples). As has always been the case, the "good programmer" resource is in the shortest supply. Yes, generalized garbage collection does have drawbacks, but it is not as bad as most C/C++ programmers suppose; and in most cases not as bad as the inferior garbage collection scheme they are already using.

      --
      Six score characters.
      Brevity being wit's soul
      I have enough space.
    60. Re:full C compatability? by UnknownSoldier · · Score: 1

      > Yes, clearly it would be complete lunacy to write video games in garbage-collected LISP, like Jak and Daxter, Ratchet and Clank and so on.

      And clearly you've even never *programmed* a game for PSX or PS2.

      Naughty Dog's Game/AI runs in Lisp, but all the low level stuff hardware interface code is C/assembly. You don't run Lisp on the GS, or SPU (PSX or PS2), or the PS2's VU's, and IOP.

      You can use almost *any* language to write a game - some just make it easier, or way harder then others, so yes, you have a valid point - don't just *assume* using a specific language is crazy - where there's a will, there's a way :)

      Abuse was another commercial game written in Lisp.

    61. Re:full C compatability? by Anonymous Coward · · Score: 0

      Which is why my libraries have a set of 'constructor' and 'destructor' functions which wrap up all the malloc/free code. Basically, the programmer shouldn't be trying to free memory allocated by my library, because my library may well be using a different malloc package to begin with.

      Relying on the programmer to code all the memory allocation is just clunky; then you end up with situations where you have to provide functions to compute how much memory you're going to need, so the programmer can allocate it, and then another function call to actually use it. And for some problems, you can't predicate the memory usage in advance, so then you need the programmer to also take care of resizing the memory area... gah. What a pain in the neck. Abstracting routines into a library is supposed to make things easier, not harder.

      With memory relatively cheap, unless the routines are performance critical (and even then, you can often do better than your average programmer by using handle objects and fancy zero copy techniques), there's really no reason not to do all the allocation into opaque objects behind well-defined interfaces.

    62. Re:full C compatability? by void* · · Score: 3, Insightful

      (From which many sensible people conclude that it's bad practice to write in C.)

      Your 'many sensible people' would be ignoring that 'libraries allocate their own memory' and 'libraries that have fixed size return data' are not the only options.

      Sure, you can do bad things in C. You can do "bad things" in pretty much any language - I just ran into an issue where a third party java library closed a stream I passed to it. It didn't create the stream, why should it assume I want it closed? It's a bogus design decision that limits the libraries usefulness - if I want a chunk of data processed by that library wrapped by other data that I write before and after the processing, I can't just write the data that goes first, pass my output stream to this lib, and then pass the data that I want after, I have to write the middle data out to a file somewhere and then reread and rewrite it. Should I now conclude that it's 'bad practice to write in java' because a third party came up with a poopy implementation of a util library?

      I recognize that C allows worse things (buffer overflows, etc) to happen when such design errors are made. However, I think that anyone writing code in C should be aware of that - the code doesn't write itself, and the root of the problem is a given programmer following bad practices. You may blame the language for allowing it, but you can't blame the language for the presence of the given overflow ... the language spec didn't write the code. With power should come responsibility.

      --


      Code or be coded.
    63. Re:full C compatability? by scotch · · Score: 1
      You said "look at the extra function calls". He said "those function calls will be compiled away". You said "yeah, but look at that extra pointer assignement". Paraphrased, of course. Just thought I'd point out the shifting argument.

      --
      XML causes global warming.
    64. Re:full C compatability? by mystran · · Score: 3, Informative
      My point was that to avoid the problem of circular references, the garbage collector does have to be more sophisticated, and sophistication takes time and (memory) space -- time and space that a program may or may not be able to spare.

      Then again, malloc needs sophistication as well, and can be every bit as slow as a good garbage collector. Indeed, even garbage collectors for C (try google with "garbage collector") can outperform the regular glibc malloc sometimes, even when there is NO reference counting involved. Which btw is another issue, reference counting + malloc pretty much combining the bad (and slow) things from both worlds.

      Pause times below 1/10th of a second? Hmm, how much below? TV-quality video is 24 frames per second, so a one-tenth second pause means dropping two or three frames. Acceptable? Perhaps, but not desirable.

      Such pausetime on a machine capable of playing TV-quality video in the first place indicate an awful garbage-collector. Even a stop-and-copy shouldn't take that much time, and these days we have generational collectors which only bother with the "youngest" stuff, that is, stuff most likely garbage. And you can make that incremental, it's not even very hard, and you can then slice the "pause" into almost as small parts as you want. There are collectors which provide real-time guarantees. Mallocs usually don't.

      With non-garbage collected language, I know that memory allocation will either succeed ort fail, and I know (or a library writer knew) when allocation happens, because I'm explicitly coding it. So I know, at this particular point in my program, either allocation succeeded or failed.

      Except this isn't necessarily true either. One example is Linux, which doesn't guarantee that there is memory left, because memory isn't allocated when you map pages, but when you touch them first time. If you allocate memory, and there's not enough free virtual memory to fill in the pages when you actually need them first time, then OOMkiller is called. Speaking of which, unless you lock (all) pages into memory, you won't know whether there'll be pauses anyway, since that memory of yours might just as well be a block of hard-drive space. Welcome to the world of virtual memory. Guess already which pause takes longer, a call to an incremental collector or the swap-in? Oh, and do you have a deterministic thread scheduler in your OS?

      Finally, if you have an incremental collector (designed for this) you could run it with priority lower than your "real-time" tasks, and you could then collect only when the processor would be idle otherwise. Dijkstra's classical tri-coloring was actually developed for a scenario where there is one processor for running the task (mutator) and another for collecting the heap (collector). That you didn't think of this pretty much proves you've got no idea about garbage collectors.

      Just because there are bad collectors doesn't mean they all are bad. And even stock solutions, over are the days when Lisp machines hanged for hours to collect their memory. Unless you are running the CPU at 100% all the time, you'll have plenty of time to collect.

      --
      Software should be free as in speech, but if we also get some free beer, all the better.
    65. Re:full C compatability? by Minna+Kirai · · Score: 1

      Abuse was another commercial game written in Lisp.

      Wrong. Abuse is now GPL, so anybody can see the source code. It consists of 157 C++ files.

    66. Re:full C compatability? by orthogonal · · Score: 1

      There are an awful lot of dashes at random places in this paragraph. Were you by chance running garbage collection?

      Yeah. That's my style -- though only for Internet posts.

      The double dashes are meant to be what printers call "em" dashes, dashes the width of the "m" character, and indicate a separate, parenthetical, explanatory or exemplary, or emphasized phrase.

      In contrast the "en" dash -- which of course is the width of an "n" character -- is used to join words as, when a verb phrase is used as a noun -- "at clean-up time (noun phrase) we do all the clean up (no dash, "clean" is actually being used as a verb) including recursively calling the clean-up routines (noun phrase) for all contained objects that we need to clean up (infinitive form of verb)".

      I like the "em" dash because it breaks up the train of thought, making the sentences "punchier" and giving it more of the sound of a impromptu -- "hey, just between you and I" (exemplary dash) -- conversation. It makes the post seem more "artless" and "real" and less contrived, less the product of work and more a dashed off and a breezy comment.

      In general, the dashed phrase is the "pull-ed out" comment on the main idea, or an emphasis or re-stating of the main idea. As such, I prefer it to be interstitial, that is, stuck in the middle with a dash on either side: main idea -- elaboration -- continuation of main idea. More rare -- for me -- is the concluding dash, which generally is for an opposing or separate -- or in any not emphasising -- idea. And unlike the previous sentences, I generally prefer only one emphasizing dash -- at most -- per sentence.

      By postponing the conclusion -- by making the reader have to wait for it during the interstitial em-dashed phrase (explanatory dash) -- I'm able to get in another thought. (And sometimes I can slip in that additional thought without having to support it with evidence -- (dash for separate but related thought -- note this is a rare "unbalanced" or non-interstitial dash) so I get it in for "free", because it's "just" an impromptu aside. I try not to abuse this too much, especially because Slashdot readers will quibble on even the smallest, tangential, peripheral points.)

      At the same time that it allows me to write longer sentences, by breaking them up it allows me to not exceed the lesser attention span most people have for reading on screen. You'll also notice that -- contrary to most traditional advice for writing (dash for insertion of related but different -- and unsupported by evidence (parenthetical dash) -- idea) -- my paragraphs are usually only a few, and other only one, sentence long.

      I do this because vertical white space -- paragraph breaks (dash for emphasis) -- make screen reading much less of a chore. Nothing is harder to read on a screen than someone's run-together mess (en dash in noun phrase) of sentence after sentence with no break. My eyes just glaze over and I ignore the whole thing.

      By using regular paragraph breaks, you get the reader to read -- or at least scan the first several words of each paragraph to see if any open of them "hooks" his attention (dash for separate but related though, of the rarer "unbalanced" form). But in fact I'm breaking a standard "rule" of traditional writing. Many of my paragraphs are -- intentionally (dash for emphasis) -- "fragments".

      But your joke is a funnier explanation.

    67. Re:full C compatability? by elhaf · · Score: 1

      Guilty. Of course I know about inlining functions, but I should have been more explicit about that knowledge up front, rather than allow someone to beat down my strawman.

      --
      Six score characters.
      Brevity being wit's soul
      I have enough space.
    68. Re:full C compatability? by Minna+Kirai · · Score: 2, Insightful

      Yes, clearly it would be complete lunacy to write video games in garbage-collected LISP, like Jak and Daxter, Ratchet and Clank and so on.

      It is a misrepresentation to claim that those games were "written in LISP".

      One can say that the "behavioral and game logic" processing was written in LISP, but that's a minor part of the overall software work- especially if you count it in terms of percentage of CPU usage. (Which, since you're talking about performance, is what actually matters)

      Games have used LISP to control higher-level flow since the 80s, but to claim that they're written in LISP is no more accurate than saying Mozilla was written in XUL.

      And those massive overheads ensure that we'll never see NASA using LISP to control space probes.

      Another misrepresentation. Actually reading that article plainly says that the performance-critical elements of the space-probe were written in C.

      Furthermore, you cannot use LISP as an example to defend all GC. LISP programs naturally give the compiler more information, allowing it to make better optimizations. Frequently it can eliminate the need to actually execute much of the GC at runtime (converting it into logically static or stack allocations). But with an imperative language like Java, the overall code is less analyzable, so the GC can't reach the same heights of performance.

    69. Re:full C compatability? by be-fan · · Score: 1

      Allocation happens at a known point in a GC too. I assume, then, that you mean free(). Now, in a GC'ed application, you can always disable GC and then call the GC at known safe-points. Say you're writing a video application. Basically, you've got a loop that displays a frame just as it is needed, and waits the rest of the time. All you have to do is call the GC during that wait period, so the GC's are quick and regular. As long as you make sure not to generate too much garbage while rendering the frame (doing lots of memory allocation in a time-critical piece of code is a bad idea anyway), you'll be fine. For most soft-real-time uses, a good GC works pretty well. Especially if you take advantage of more advanced GCs that allow you to mix various allocation techniques (manual pool, automatic gc, etc) in the same program.

      --
      A deep unwavering belief is a sure sign you're missing something...
    70. Re:full C compatability? by tyrecius · · Score: 2, Insightful

      You make a number of good points. I agree that the instances where garbage collection is infinitely better than any other tool. However, there are also places where ownership is the better tool. I am not going to make the specious 'it is faster' argument here, because usually it doesn't matter.

      An ideal language for me would be one where there is a GC (possibly as a default), but that also allowed ownership semantics where that is applicable. Now I am going to talk about situations that I have run across where GC wasn't that useful. Note that I am not making an argument that GC is bad (it is usually very good), but that there is a case to be made for a language where GC isn't required in all cases.

      There are many cases where order of destruction is very important. There are cases where this is implicit. For instance, it is best that a 'successful completion' message is written to the log file before the log file is closes.

      But there are cases where an elegant solution can depend on it. A good example of this would be streams. Streams, for the sake of argument, are objects that take in a variety of data, turn that data into bytes, and send those bytes someplace else.

      Often, a stream will have attributes defining how it processes the incoming data. If the incoming is a bool and true, does it turn it into the character '1', the sequence of characters "true", or the byte 0x01? Floats (how many sig figs?), signed integers (put a sign at the front if its positive?), etc. also have choices to be made.

      But if a caller sends a stream to a method for output and the method changes the state for some reason, later output might be unexpected. This is where a stack-based allocation could come in handy. A new kind of object can be created which saves the stream in its constructor and restores the stream in its destructor. If these happen at known points in the program, then all is well. If the destructor (or finalizer) is called at an undefined point, badness results.

      Such a stream-state-saver object can be used by the caller to make sure that the method doesn't screw with the state. Or it could be used by the method to make sure that it doesn't step on the callers toes.

      The other case where a GC might not be a help is if one were trying to develop a new kind of GC. There is no way in Java, for instance, for me to develop my new "tyrecius' patented GC" as a Java library in any kind of transparent way. I'd have to go in and modify the guts of the compiler/VM.

      Finally, memory is just one kind of resource. GC's generally don't make dealing with other resources very easy. The best that one can do is to put the release of the resource in a finalizer of some kind and hope that the resource will be released in a timely manner. File Descriptors, network Sockets, database connections, etc. are all harder to deal with in an efficient and brainless way in a GC-only language.

      Let me reiterate that GC is great to have in a language. But I tend to be nervous about a language if there is not a way to bypass it in the few instances when it becomes a problem.

      --
      char a[]="lbiitgt l e \n\n\0";main(){for(char*c=a; *(short*)c;c+=2){putchar(*(short*)c);}}
    71. Re:full C compatability? by jareds · · Score: 1

      Yes, But the difference in that case is that malloc happens at a known point. You can intentionally place such actions in non-time critical sections of your program. The problem the OP was refering to is that with garbage collection, the garbage collection could occur during a time-cirtical section. Something which you as a programmer could avoid otherwise.

      But garbage collection likewise only occurs when memory is allocated*! Code that could call the garbage collector is not inserted between every statement or something. That would be absurd. Thus, don't allocate memory during a time-critical section.

      *This isn't entirely true, but the other cases aren't relevant to this discussion.

    72. Re:full C compatability? by Dash-o-Salt · · Score: 1

      Yep, in Java as long as there no longer exist references to an object, the Garbage collector will come along and clean it up.

      Of course, remember that if the object you are trying to set to null is in a list, you must also make sure to remove it from that list - otherwise there will still be a reference to that object, therefore not letting the object be garbage collected.

    73. Re:full C compatability? by Anonymous Coward · · Score: 0

      D provides the call
      gc.disable()
      which causes the GC not to run until you re-enable it. So you CAN make the same almost-realtime guarantees that a C program can make.

      Likewise, you can replace the standard library (phobos) with an alternative you have designed which either doesn't do GC at all, or which does GC the way you like it.

      I'm a long-time member of the D newsgroup, and here's a good rule about D: Walter most likely has thought about it before you. He has explicitly targeted this language as a system programming language, and thus it is not acceptible for the language to be fundamentally slower than C.

      All advanced features can be either disabled or simply ignored, if you need to do so for performance. You can write "bare metal" C-like code in D that has no more overhead or complexity than C. But you can also write advanced, slick code that is easeir to read & easier to write than either C, C++, or Java.

      Please, read about the language before you just assume that all garbage collected languages are broken for realtime applications.

      Russ Lewis

    74. Re:full C compatability? by WalterBright · · Score: 2, Informative
      D offers several ways to do allocation, gc is only one of them:
      • garbage collection
      • using C's malloc/free
      • stack allocation via alloca()
      • automatic stack allocation and cleanup (RAII technique)
      • static data
      • overloading new/delete on a per-class basis
      • writing one's own functions to allocate/release memory
    75. Re:full C compatability? by SphericalCrusher · · Score: 1

      Well, aren't you just a rocket science. Want to tell me how I might be, or do you just want to try to make yourself look smarter by saying that?

      --
      "Instant gratification takes too long." - Carrie Fisher
    76. Re:full C compatability? by elhaf · · Score: 1

      Yes, very good points that I mainly agree with. I think it comes down to the level of control. Being a system-level guy, I am used to having the control I want when I need it. Most implementations of GC seem to take this away. Obviously, in most cases one wants to leave gc up to the system, but there are many times when we want a finer level of control, and we want it to be natural. And then, my pet peeve is that we should always but always be able to replace default crappy gc's with the far more clever ones of our own devising. This might be something solved by open sourcing of these systems, but I think a decent system design would simply leave something that important open for improvement. Some apps care about good GC, and some don't.

      --
      Six score characters.
      Brevity being wit's soul
      I have enough space.
    77. Re:full C compatability? by WNight · · Score: 1

      There's a difference between expecting a library to allocate space for new instances of objects you create and expecting it to allocate space for strings it returns. Calling foo.delete() is different than FreeString(foo).

      Gnerally, for buffers and such, the highest-level code that looks in the buffer should allocate it and pass it to every other level of code.

      This way, ideally, the allocate and the free are next to each other.

    78. Re:full C compatability? by crucini · · Score: 1

      So how should a library author avoid this? We need to allocate lots of little chunks that the application author shouldn't have to see. That's why we have appropriate free() functions the app author can use to clean up afterwards.

      Some libraries allow the caller to pass in a function pointer to his own malloc, which can add diagnostics or alloc from an application memory pool.

      I'm not sure what you regard as best practice here. We can't have the caller allocate everything in advance, like you would allocate a sockaddr, because the library may be building data structures with lots of dynamically allocated nodes.

    79. Re:full C compatability? by Anonymous Coward · · Score: 0

      Handling of circuler references falls naturally out of most GC algorithms. One of the simplest possible memory algorithms is the mark & compact GC, which handles circuler references naturally.

      Realizing that Java after 10 years of development still doesn't run a concurrent GC by default could give you a clue on how "simple" GC, namely mark & compact or it's three-colour concurrent variant in RL are.

      *t

    80. Re:full C compatability? by be-fan · · Score: 1

      I never said that mark & compact was a good GC. A naive mark & compact can have very bad performance. However, mark & compact can be really simple to implement, and still handle circuler references. The comment was designed to counter the OP's assertion that the handling of circular references necessitates that the memory allocator be complex.

      --
      A deep unwavering belief is a sure sign you're missing something...
    81. Re:full C compatability? by Anonymous Coward · · Score: 0

      Jeezus Christ are you an asshat.

      For god's sake, get a job.

    82. Re:full C compatability? by Anonymous Coward · · Score: 0

      So, no, we won't (realistically) be able to turn off the garbage collector, which means that we won't be able to write real-time programs, and it'll even be touchy writing programs, such as, oh, audio or video players, that require near real-time performance.

      But you can use inline assembly! So, what's the problem?

    83. Re:full C compatability? by jasonsingha · · Score: 1

      Many garbage collectors are only triggered whenever you allocate an object. This means you can just allocate lots of objects as part of your start-up routine, and then as long as you don't create any more objects, you'll get absolutely no gc pauses. The only negative things I would say about garbage collected languages is that very few implementations give you different gc strategies to choose from and many garbage collected languages make it difficult to know when allocation is occuring. (For example, most Scheme implementations will create garbage when you add two floating-point numbers.) This is more of the problem with the languages and their various implementations and rather than with the concept of garbage collectors. The beauty of plugging in new collectors would be that one option for a "garbage collector" could really just be malloc (and free of course) to make the system more suitable for certain uses.

    84. Re:full C compatability? by HiThere · · Score: 1

      For that you'ld do better to allocate the memory outside the loop, and then just reuse it rather than going through the entire allocate/release cycle. In that kind of a situation you don't want to do any memory allocation/release.

      Now I'll grant that one can't always manage this, so in that case one can use automatically managed memory as a supplement on an as-needed basis.

      This all depends a lot on just what is being done, though. The entire area of Hard RealTime is quite small. And if you really MUST, D allows you to drop into assembler for some sections (as large or as small as you need).

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
    85. Re:full C compatability? by Carewolf · · Score: 1

      That depends very much on how the allocation/deallocation is done. The examples I've seen where garbage collection was proven or shown to be faster have all used malloc/free ineffeciently.

      In much the same spirit, I've seen a few reports proving garbage collection to be slow, that had lously garbage collectors.

      The only thing that seems certain is that garbage collectors use more memory, and they can always be beaten in speed by a malloc implementation that also allocates too much memory by using large blocks (2^n), or dealloacting in chuncks (arenas, regions).

    86. Re:full C compatability? by newhoggy · · Score: 1
      I agree that garbage collection can be very efficient.

      My complaint about garbage collection is that it only solves the memory problems. It doesn't solve deallocation problems with other resources, which are generally more expensive and more limited.

      Wrap up a resource in an object and you don't know if the resource will be cleaned up in a timely manner. The object could be sitting in idle after I've severed all references to it and because of that, precious resources aren't being returned to the operating system.

      In order to free system resources properly means I need to explicitly dispose of each resource wrapping object. (This is the design decision made in SWT.) But what's the point of a garbage collector then?

      I like C++ because it's "Resource allocation is acquisition" strategy can be consistently used for memory allocations as well as system resource allocation.

      My main gripe with C++ is its lack of reflection.

      Other things I would like to see in C++ are:

      • Cleaner syntax for functional programming.
      • The virtual/overrides/new syntax from C#.
      • More memory management facilities in the STL.
      • Thread management and RPC facilities in the STL.
      But one question: Couldn't an incremental collection also trigger a swap-in?
    87. Re:full C compatability? by truth_revealed · · Score: 1

      Malloc is still ridiculously expensive compared compared to what a generational GC can do. A malloc is dozens to hundreds of instructions, while in many cases (eg: when you're following the typical functional-language allocation patterns), a generational GC can alloc in just a few instructions. And while the GC phase itself is hardly speedy, the amortized cost of the GC is much lower than the non-amortized cost of doing all those free()'s individually.

      What a bunch of complete nonsense. Please put up some numbers and/or URL links to back your ridiculous claims. You obviously never heard of the ultra-high performance malloc/free memory allocator Hoard. Nevermind the fact that garbage collection schemes tough every page in memory while they mark and sweep and defeat the CPU's high speed caches. Don't believe me? Read what Linus says on the topic.

    88. Re:full C compatability? by Mr.+Piddle · · Score: 1

      I'm not sure what you regard as best practice here.

      I'm not sure there is a best practice. Using multiple third-party libraries with different malloc conventions in a medium to large project with typical employee turnover, documentation, and testing just plain sucks all around. I'd say malloc is by far my least favorite aspect of C programming; in fact, I think popularizing garbage collection is one of the best contributions of Java to computing.

      --
      Vote in November. You won't regret it.
    89. Re:full C compatability? by lsdino · · Score: 1

      There's a real good way to handle (pun intended) this: handles!

      You have an API that returns a handle instead of returning data its self. This handle could even be a pointer in disguise, but as far as the caller is concerned, it's a handle. There are quick ways to disguise pointers, for example shifting the lowest 2 bits off and setting the high 2 bits to some pre-determined value. Then you have a quick validity check for whether a handle is valid or not (if the high 2 bits are set appropriately). And the handle doesn't point to anything that's close to memory.

      From there on out if the caller wants to do anything with the handle they call your APIs to get additional data. At some point you may need to hand someone a buffer, but it can either be an agreed to size (eg, some fixed structure) or it can be passed with a maximum size, or there can be some method for the caller to determine the size of the buffer. Any APIs that doesn't work for can also return handles :)

      A GC isn't going to be able to trace through this but the two pieces of code could have independent GCs that won't be able to trace into each other's memory space. The library half would have a set of static roots that keep this memory alive until the app side calls a free handle API. Then the library half removes the static root and the memory can be reclaimed by it's own GC (or whatever memory allocation scheme its using).

    90. Re:full C compatability? by saroth2 · · Score: 1

      Movies are 24 frames per second, television is 30 frames per second progressive or 60 fields per second interlaced.

    91. Re:full C compatability? by Anonymous Coward · · Score: 0

      An emdash: . Maybe an emdash: --. Definitely not an emdash: --. Note that Slashdot stripped out the real emdash.

    92. Re:full C compatability? by metamatic · · Score: 1

      I don't see what your response has to do with my (sarcastic) comment. The point is that Naughty Dog's games run LISP, yet they don't sit and pause for garbage collection.

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    93. Re:full C compatability? by metamatic · · Score: 1

      The point isn't whether the entire system was written in LISP, or whether Java may or may not be worse than LISP.

      The point is that LISP clearly is suitable for both performance-critical and memory-tight systems, in spite of its use of automatic memory management.

      Hence the original claim, that automatic memory management means bad performance and memory bloat, is false.

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    94. Re:full C compatability? by stripes · · Score: 1
      Nevermind the fact that garbage collection schemes tough every page in memory while they mark and sweep and defeat the CPU's high speed caches.

      Mark/sweep is older then I am (and I'll hazard a bet I'm older then you), and wasn't state of the art by the end of the 1970s!

      Generational garbage collectors (at least some of them) are normally tuned to do a primary pass inside of the L2 footprint, and for some workloads do a good job of making the L1/L2/L3 cache more effective.

      Some hardware garbage collectors are pretty amazing.

      And those are just things I happened to read papers on in the late 80s to mid 90s! A decade behind state of the art! (the hardware GC was actually just barely into the 80s, and was suitable for hard real time use).

      Are they more effective then well written malloc/free? If you look only at the cost of the alloc and free and the in use check it is hard to see how GC could really be cheaper then perfect use of malloc/free. If you look at cache effects one would assume GC comes off worse, but that can actually make things better. If you allow hardware assisted GC things can get even better for GC, but it is hard to imagine how that would happen on a modern CPU (it could be done, but...unless it were on the CPU I'm not sure all the cache coherence traffic would make it as big a win as it once was).

      I'm not convinced that GC belongs in a bare metal all out speed language, but I'm not entirely convinced it doesn't. I am seriously convinced that there is room for a "very very fast, but maybe not as fast as C" language that has GC. After all GC eliminates a whole class of bugs, and that leaves more time to either optimize the algorithms or to add important functionality, or to get on with things and write another program. Any of those things might well justify a small speed loss. If they didn't, why is Perl (normally much slower then C) so popular?

    95. Re:full C compatability? by stripes · · Score: 1
      But garbage collection likewise only occurs when memory is allocated*!

      I know you have a footnote saying "I know this isn't exactly true"... but... it is very not true in Java and may be in D. In Java for some implementations at least there is a low priority thread that does GC. So any I/O can easily turn into I/O plus a GC. Or on a multi-processor it might "just happen" almost any time.

      Yes, if you were designing D you could have some way to disable GC when you want it off, but blanket assertion that "GC isn't a problem here" is almost as bad as proponents of malloc/free saying "hey, any good programer never forgets a free...or does it twice".

    96. Re:full C compatability? by stripes · · Score: 1
      My complaint about garbage collection is that it only solves the memory problems. It doesn't solve deallocation problems with other resources, which are generally more expensive and more limited[...]I like C++ because it's "Resource allocation is acquisition" strategy can be consistently used for memory allocations as well as system resource allocation.

      D's manual claims it supports RAII through auto variables. D's auto variables look like C++'s auto_ptr, except you can't use them as return values (I think you can use them as out arguments though). In C++ I really despise auto_ptr, the boost shared_ptr works much better (at a modest loss in speed).

      I haven't used D, so I can't say how well it's auto really works. It seems awkward to use across function calls while C++'s RAII is no more awkward across calls as all inside one function.

      If you havn't looked at the boost libs, you owe it to yourself to take a peek. It might cross "More memory management facilities in the STL" off your list.

    97. Re:full C compatability? by stripes · · Score: 1
      I always wonder why anyone worries about the tiny incremental hit of function calls/vtable lookups in C++

      Indirect jumps can be 20 times as costly as a direct jump, at least on a modern CPU. On a 68020 it isn't quite twice as slow. On some CPUs they almost assure a full pipeline stall. So it ain't all that tiny, unless the virtual functions are quite large.

      If the application is so speed- or realtime-oriented that you can't afford having the compiler do some work for you, then write it in C...maybe throw in some C++-style patterns (typedef'd void pointers, etc) to help the compiler a bit. If the application requirements aren't that stringent, relax, use GC if you can, run the compiler, and think of England.

      Ok, so I can normally afford the vtable jumps :-) Depending on how good the GC is, I might be able to afford it too. Some day I'll get a chance to give D a shot and find out. After all sometimes I get to use perl...

    98. Re:full C compatability? by stripes · · Score: 1
      This is where a stack-based allocation could come in handy. A new kind of object can be created which saves the stream in its constructor and restores the stream in its destructor. If these happen at known points in the program, then all is well. If the destructor (or finalizer) is called at an undefined point, badness results.

      D has a stack-based allocation scheme, declare your variable auto and you get something that will be destructed when it goes out of scope. According to D's manual:

      The auto attribute is used for local variables and for class declarations. For class declarations, the auto attribute creates an auto class. For local declarations, auto implements the RAII (Resource Acquisition Is Initialization) protocol. This means that the destructor for an object is automatically called when the auto reference to it goes out of scope. The destructor is called even if the scope is exited via a thrown exception, thus auto is used to guarantee cleanup.

      Unfortunitly it also says:

      Auto cannot be applied to globals, statics, data members, inout or out parameters. Arrays of autos are not allowed, and auto function return values are not allowed. Assignment to an auto, other than initialization, is not allowed. Rationale: These restrictions may get relaxed in the future if a compelling reason to appears.

      So while it can be used for simple things, it looks painful to use for stuff that shared_ptr or even the reviled (by me!) auto_ptr can do so well.

    99. Re:full C compatability? by mystran · · Score: 1
      My complaint about garbage collection is that it only solves the memory problems. It doesn't solve deallocation problems with other resources, which are generally more expensive and more limited.

      This is a problem, I have to agree. In some cases this is non-issue, since the use of garbage-collector doesn't prevent the destructors, for example in the form of Java's finalizers, but indeed those are non-deterministic. And I agree that while not collecting some memory usually means just a loss of address space (usually not physical ram since there's paging), leaking stuff like threads or file-descriptors (or handles or whatever) can be real pain.

      The model where you explicitly deallocate external resources is one possible solution. One possible thing is having your wrappers keep track of the external resources, free those explicitly, and have a finalizer which can do this implicitly, but possibly with a warning. This way you can use the same garbage collector for collecting memory, and as a leak-detector for the external resources. If a wrapper becomes garbage before disposed properly, then you would have a leak, and you can track these to catch the cases. Garbage collector and a leak detector are more or less the same thing after all.

      But one question: Couldn't an incremental collection also trigger a swap-in?

      Indeed, this is possible, especially when you are running low on memory (or your whole process is swapped out). One idea with generational collection is that we only collect the most likely garbage, so there's no need to swap in everything, and since we are usually collecting the youngest objects, those are already most likely to be in memory. But indeed, swap-in can happen. On the other hand, if you use smart-pointers or reference counters, it's likely to be much harder to control what's touched.

      Actually there's been quite a bit research into partially application controlled memory management, often together with "user-level" memory managers. Garbage collectors are sometimes mentioned but (not that I've searched) I've yet to see a paper where application controlled memory management and garbage collector would be combined into a single manager, which could effectively control both page and object level memory management. I think having control over swapping might be a great benefit for both general and special purpose garbage collectors.

      --
      Software should be free as in speech, but if we also get some free beer, all the better.
    100. Re:full C compatability? by Tukla · · Score: 1

      On Slashdot, it would be used so rarely that everyone would forget about it.

    101. Re:full C compatability? by stripes · · Score: 1
      automatic stack allocation and cleanup (RAII technique)

      Something I didn't find on digitalmars is a discussion of what you do if you want RAII on objects you return from a function (auto can't be returned, or be an out parm, right?). What is the D equivalent to a shared_ptr of iostream (or a auto_ptr of the same)?

      What would a library use to hold objects that might be heavy weight objects (network sockets maybe, or 3D textures stored on a graphics card)?

      Is there some idiom for it?

      Oh, and is there a weak reference for use in caches or the like? (yeah, ok, so it always looks so good in manuals, and I've never gotten around to using them for caches, but I have used it in a few places for things like "call the timeout function in 20 seconds if this request is still alive")

    102. Re:full C compatability? by WalterBright · · Score: 1
      what you do if you want RAII on objects you return from a function (auto can't be returned, or be an out parm, right?).


      You'll need to use the delete on those.



      What is the D equivalent to a shared_ptr of iostream (or a auto_ptr of the same)?

      Not necessary in D, use the gc to manage routine memory.


      What would a library use to hold objects that might be heavy weight objects (network sockets maybe, or 3D textures stored on a graphics card)? Is there some idiom for it?

      Depends on the situation, but one idiom that works well is to create an RAII object that holds the resource, and create that in the user code, not the library.


      Oh, and is there a weak reference for use in caches or the like? (yeah, ok, so it always looks so good in manuals, and I've never gotten around to using them for caches, but I have used it in a few places for things like "call the timeout function in 20 seconds if this request is still alive")

      There's currently no support for weak references.


    103. Re:full C compatability? by stripes · · Score: 1
      Not necessary in D, use the gc to manage routine memory.

      That is why I used the example of auto_foo of iostream since an iostream normally has a file descriptor which is allocated out of a limited space and you want a quick release of for other reasons (forcing the final flush).

      Depends on the situation, but one idiom that works well is to create an RAII object that holds the resource, and create that in the user code, not the library.

      Right, but if there is a library that holds objects and does something good with them (hashes look like they are built in, but maybe a OctTree for handling arbitrary shaped regions in 3 space or something). I have some kind of heavy weight object (like the 3D texture stored on a graphics card). I want to use the OctTree lib to manipulate my objects. How do I use the lib, but get prompt deletion of my objects?

      Not having a good answer for that wouldn't stop me from using D, just from using D for some things.

      I assume I can force a GC if I find out I'm out of storage on the 3D card (or out of file descriptors), am I right? (that might be a good workaround for some things)

    104. Re:full C compatability? by stripes · · Score: 1
      Indeed, this is possible, especially when you are running low on memory (or your whole process is swapped out). One idea with generational collection is that we only collect the most likely garbage, so there's no need to swap in everything, and since we are usually collecting the youngest objects, those are already most likely to be in memory. But indeed, swap-in can happen. On the other hand, if you use smart-pointers or reference counters, it's likely to be much harder to control what's touched.

      With ref counted smart pointers isn't the thing that is touched the thing that is being deallocated? Even then only if it has a destructor? And since it is deallocated promptly after the last ref goes, isn't that frequently shortly after it has just been used for the last time? (I admit, sometimes it is long after in some of my code, but not normally)

      I can see GC having advantages in packing things, or just plain in not having to bother with calling delete (but boost::shared_ptr gives that, as long as you avoid cycles)

    105. Re:full C compatability? by WalterBright · · Score: 1
      You can delete objects explicitly to get prompt deletion.


      Yes, a gc can be forced.

    106. Re:full C compatability? by tyrecius · · Score: 1

      Thanks for pointing this out to me. I don't know all that much about D apart from the feature list they posted.

      One thing you mentioned in passing was that you revile auto_ptr. auto_ptr definitely has its limits, but I'm curious as to why you detest it.

      --
      char a[]="lbiitgt l e \n\n\0";main(){for(char*c=a; *(short*)c;c+=2){putchar(*(short*)c);}}
    107. Re:full C compatability? by stripes · · Score: 1
      One thing you mentioned in passing was that you revile auto_ptr. auto_ptr definitely has its limits, but I'm curious as to why you detest it

      Ok, so maybe I shouldn't detest it so much, and I wouldn't if it wasn't the only smart pointer the standard had that attempts to do lifetime management for you. Sure if they had a more general purpose one (like boost::shared_ptr, which I hear is the he next draft standard) and presented auto_ptr as a lightweight alternative to use in carefully restricted areas, then, yeah, sure.

      However as the only stab at "no GC for you, try this" it isn't so hot. It can't really be stored in a vector for example (it mostly works, but because of the transfer of ownership semantics mean if an unexpected copy is made of an element it kind of vanishes...and vector doesn't say "and no little bit of leftover debug code takes a peek"). So not only does it not work in STL containers, it actually seems to but fails at random seeming times. Or (I expect) may work on some implementations and fail on others.

      To be honest at one point I thought I knew when I could abuse a vector of auto_ptr, and well, I was only mostly right. That soured me on them. Maybe unfairly because I knew I was abusing them...even so I have seen many people use them where they shouldn't without realizing it. The standard needs better warnings...well, plus an alternative so people don't wander down the garden path just because it seems simpler then writing their own smart_thingie_with_a_cool_policy_ptr.

    108. Re:full C compatability? by mystran · · Score: 1
      With ref counted smart pointers isn't the thing that is touched the thing that is being deallocated? Even then only if it has a destructor? And since it is deallocated promptly after the last ref goes, isn't that frequently shortly after it has just been used for the last time?

      Well, the biggest problem with ref-counts is that they are slow. You waste a lot of time updating the reference counts, and when compared to regular pointers, you add one level of indirection to every memory access. Thanks to how caches work, especially with relatively small objects this can mean that you need about twice the amount of cache to actually hold your working set.

      Another problem is freeing. When a ref-count reaches zero, and you free a node, you now have to check whether any other nodes also became free'd, and so on. Alternative strategy would be to free those objects lazily, only when needed, but then you are just as deterministic as any other GC, and ref-count isn't that good strategy anymore.

      There are strategies to prevent unnecessary updates to ref-counts, but these usually involves either handling the counts manually, or having support in compiler. Especially with smart-pointers it can be hard to prevent those, the creation of pointer objects themselves take time (and memory) too.

      --
      Software should be free as in speech, but if we also get some free beer, all the better.
    109. Re:full C compatability? by stripes · · Score: 1
      Well, the biggest problem with ref-counts is that they are slow. You waste a lot of time updating the reference counts, and when compared to regular pointers, you add one level of indirection to every memory access. Thanks to how caches work, especially with relatively small objects this can mean that you need about twice the amount of cache to actually hold your working set.

      Not all ref counted objects have an extra level of indirection. I think that boost::shared_ptr ends up passing two pointers around, which has cache effects but not indirection effects. Somehow my mind skipped over that. Other implementations can store the reference count in the object they point to, which still has some effect on cache sizes but not the same as either increasing the size of a pointer, or doing an extra level of indirection.

      Another problem is freeing. When a ref-count reaches zero, and you free a node, you now have to check whether any other nodes also became free'd, and so on. Alternative strategy would be to free those objects lazily, only when needed, but then you are just as deterministic as any other GC, and ref-count isn't that good strategy anymore.

      Er, doesn't GC have the same problem? When the GC gets around to discover that foo is no longer in use it'll find the 15 things that only had foo referencing them and delete them too, right? (and I assume "deterministic" was intended to be "nondeterministic" right?)

      As a practical matter I have started using boost::shared_ptr for more or less all pointers in my last few projects and they have all managed to be "fast enough". If I had the option of using GC I would give that a shot to see if it was fast enough too, but I couldn't really do without deterministic delete times on some objects. I guess what I really want is to be able to tell the language whether I need GC'ed pointers or ref counted pointers to specific types and then just let it deal with them.

      I've used garbage collected languages (APL for example) before, and liked it. Reference counts are almost as easy to use and let you manage heavy weight objects. In fact I suspect a lot of Perl programers think they have garbage collection (they currently have ref counts plus a kludge of a GC pass more or less at program exit).

    110. Re:full C compatability? by mystran · · Score: 1
      Not all ref counted objects have an extra level of indirection.

      I admit, that's true.

      Er, doesn't GC have the same problem? When the GC gets around to discover that foo is no longer in use it'll find the 15 things that only had foo referencing them and delete them too, right?

      Except GC's don't usually work that way. The usual way is to NOT keep track of what points where, but instead travel those reachable nodes that haven't been travelled to yet. We don't care WHEN an object became unreachable. We only care if an object IS (un)reachable. Actually we might not care about that either, and might simply figure out whether an object WAS reachable when it was last checked.

      Mark&Sweep (at least with incremental collector) works basicly by travelling down from root-nodes, marking stuff "reachable" until hitting a dead-end or reaching a node already marked "reachable". Once the collector is done marking, it sweeps over the heap, freeing everything not marked, and unmarking the rest. There are a lot of ways to optimize this ofcourse, but this is the basic idea.

      Stop&Copy (which isn't usually done with C for obvious reasons) simply copies everything reachable from one heap to another. Once done, we know that anything not copied is garbage.

      There are a lot of variations, but no good implementation cares when you free something. Ofcourse if mark&sweep is done in background on cpu idle-cycles, it might happen that one run missed some lately released objects, but that doesn't matter, because they'll be collected in the next run anyway.

      Like said, the trick is that while you have to handle the free'd chain of objects with ref-counts when you free it, a GC can run on background, using those cycles you'd just idle. This basicly means that as long as you have enough idle cycles for the GC to be able to collect enough garbage, you never take any delays.

      (and I assume "deterministic" was intended to be "nondeterministic" right?)

      Indeed. The sentence was intended sarcastic.

      [...] but I couldn't really do without deterministic delete times on some objects.

      Like I said above, nothing prevents you from explicitly managing some objects manually, or at least requiring them to be disposed manually. You can then benefit from GC as a "leak-detector" for those objects. Just add a finalizer (maybe in debug build) and make it check if the object was properly disposed.

      --
      Software should be free as in speech, but if we also get some free beer, all the better.
  4. Old news by AKAImBatman · · Score: 4, Interesting

    1. D is not new. If this D is new, then we've got about 50 of them floating around by now.

    2. Java and .Net are successful because they protect the program from complete failure. (i.e. error recovery ability) Making a C compatible language isn't going to help anything.

    3. If a new popular language does come on the scene, you won't notice it until it has nearly taken over the world. Oh, and developers will love it so much they'll drop everything else (like what happened with Java).

    1. Re:Old news by mark_lybarger · · Score: 2, Interesting

      the java jvm can lock up hard. makes recovery quite interesting.

      also java and .net are "successfull" b/c of general investment from big companes. there's lots of marketing dollars selling products and articles about these platforms. the PHB's read the PHB magazines, and those mags have articles re java and .net. Do those mags have articles on D? then it's not a competition.

    2. Re:Old news by illusioned · · Score: 1

      Did I miss something? Most of the developers I know have used Java, but they haven't dropped C/C++ as their main development language.

    3. Re:Old news by fforw · · Score: 3, Interesting
      the java jvm can lock up hard. makes recovery quite interesting.
      Off course it can lock up (nothing is perfect) , but it never occured to me. I experienced a few thread deadlocks, which are also not nice to debug, but only had one complete java VM crash - and that was due to faulty memory as memtest86 revealed.
      also java and .net are "successfull" b/c of general investment from big companes. there's lots of marketing dollars selling products and articles about these platforms. the PHB's read the PHB magazines, and those mags have articles re java and .net. Do those mags have articles on D? then it's not a competition.
      Sure there's a lot of hype around java related issues, but that isn't the reason for it's success. ( Every commercial software is hyped, dummies fall for hype - news at 11)

      Java is successfull because:

      • it offers a nice abstraction for system specific issues which is only seldomly leaky.
      • you can dive into an unknown project, select a random source file and understand it. You may have problems getting the big picture, but the code itself is there - there are no suprises like operator overloading, defines etc. All you need to know about the class is in it (and it's superclass and interfaces)
      • its complex enough to do some magic in it, but the idiot next cubicle can't run totally amok and wreck the whole system.
      IMHO all these reasons are more important than for Java's success than hype.
      --
      while (!asleep()) sheep++
    4. Re:Old news by Trejkaz · · Score: 1

      Actually making a C compatible language helps a language get usage without some poor soul having to port or wrap every library to a new language. In D, if you want to use GTK, you just use it, like you do in C. You link to it, like you do in C. If Java were that easy to work with, it would have taken off far faster than it did. In fact Sun wouldn't have had to waste their time devising whole new toolkits for it.

      That being said, D is supposed to manage your memory to some extent, and is generally made in such a way that you don't need to do pointer arithmetic, and unless you do pointer arithmetic, there isn't much you can do to segfault the application. I presume it has exception handling like C++, but hopefully better.

      --
      Karma: It's all a bunch of tree-huggin' hippy crap!
    5. Re:Old news by Eagle5596 · · Score: 1, Informative

      Do you even know what you are talking about? C/C++ has all the error recovery facilities of Java, and has had them for quite a while now. All Java offers is a cross platform unstable graphics suite, and a set of annoying libraries, and bad object oriented design (Main should not be an object).

    6. Re:Old news by mark_lybarger · · Score: 1

      you can dive into an unknown project, select a random source file and understand it. You may have problems getting the big picture, but the code itself is there - there are no suprises like operator overloading, defines etc. All you need to know about the class is in it (and it's superclass and interfaces)

      that's often the case (possibly b/c good textbook examples exist and java programmers tend to study on coding habits and patterns). but java code can be written as messy as perl or any other language. also, perl code could be written to be readable, it's just that most often it isn't.

    7. Re:Old news by Anonymous Coward · · Score: 0

      Are you retarded?

    8. Re:Old news by b17bmbr · · Score: 2, Funny

      also, perl code could be written to be readable

      no. it can't.

      --
      My problem? I was perfectly gruntled, until some numbnuts came by and dissed me.
    9. Re:Old news by nhavar · · Score: 1

      "you can dive into an unknown project, select a random source file and understand it." HA! You haven't seen the same code that I've seen.

      --
      "Do not be swept up in the momentum of mediocrity." - anon
    10. Re:Old news by Anonymous Coward · · Score: 0

      Actually it can be written to be readable but it rarely ever is, as the granparent mentions. Pick up a perl book and see for yourself. Oh and by the way it's... Democrats: Party of Big Govt Republicans: Party of Really Big Govt ...At least that's what history shows us. This would be another time to pick up a book and actually read it.

    11. Re:Old news by Anonymous Coward · · Score: 1, Interesting

      A better summary of why java has been kinda successful would be:

      Java allows a large team of inexpensive, mediocre programmers to put together an application that will mostly work, without a large team startup cost.

      There are some good applications written in Java. It is possible. But most of them are mediocre - and that's not a criticism of Java, rather one of it's strengths. If the same development team had been using another language the product would never have shipped at all.

      Java's strength is not the cross-platform, write-once, debug-everywhere features (you can develop cross-platform code far better in C++ with the right cross-platform libraries) it's that it is well suited to large teams of developers, and is fairly resistant to damage caused by lack of talent on the part of some fraction of those developers. It has many of the same strengths as COBOL, and those strengths make it the perfect language for corporate sweatshop development.

    12. Re:Old news by hak1du · · Score: 1

      Java is successfull because:

      Those features have been true of many programming languages. What distinguished Java from those other, less successful languages really was just hype: originally, the applet and Internet-related hype, later the anti-Microsoft/anti-lock-in rhetoric (which is ironic, because now people find themselves locked into Sun Java).

    13. Re:Old news by fforw · · Score: 1
      Those features have been true of many programming languages.
      Can you name any?
      --
      while (!asleep()) sheep++
    14. Re:Old news by Anonymous Coward · · Score: 0

      And again these idiots at slashdot mod this a 2! This post is ignorant and retarded and obviously the author doesn't know shit about Perl. Fuck you slashdot.

    15. Re:Old news by corban.elektrolite · · Score: 1

      (Main should not be an object)

      this simply is wrong. main is a static method of a class just as the main function in c is a function in a file. and static means this class does not need to be instantiated (that would produce an object) in order to execute the main method.

      All Java offers is a cross platform unstable graphics suite, and a set of annoying libraries, and bad object oriented design

      come on. this is just the usual fud. both awt and swing are stable. and the oo design of java is a very sophisticated one (to inherit from multiple classes is a real mess, better implement multiple interfaces and delegate for instance). and calling the core libraries "annoying" is just your opinion.

      btw, i do not really see why so many people complain about swing performance. using 1.4.2, it runs as smooth as a native app on an amd 630mhz pc. the only bad thing is the jfileselector which no one should use, take the native awt dialog.

      --

      this is not a real sig.

    16. Re:Old news by Eagle5596 · · Score: 1

      (Main should not be an object)

      this simply is wrong. main is a static method of a class just as the main function in c is a function in a file. and static means this class does not need to be instantiated (that would produce an object) in order to execute the main method.


      You are right, you don't need to instantiate the class to call main, but the fact still remains it has to be part of a class. This sort of mindset is wrong headed. Your main program isn't a class in any sort of intelligent OO design sense, OO is about packaging things which ought to be classes as classes, not everything.

      All Java offers is a cross platform unstable graphics suite, and a set of annoying libraries, and bad object oriented design

      come on. this is just the usual fud. both awt and swing are stable. and the oo design of java is a very sophisticated one (to inherit from multiple classes is a real mess, better implement multiple interfaces and delegate for instance). and calling the core libraries "annoying" is just your opinion.


      It's not fud at all, I use Java on a regular basis, awt and swing frequently have serious problems where they either hang, or throw an exception for perfectly normal behavior. I still use Java because, at this posting, it's the only truly cross platform graphics suite available, but it still is buggy and unstable.

      Calling the libraries annoying is far from opinion. On the lowest level, I should not have to use System.out.println("Whatever"), that level of nesting is downright ridiculous. Furthermore, I shouldn't have to triple wrap my input and output streams just to use them for character based input and output. On a more sophisticated level, several of the implementations of standard data structures are not optimized, and have a really poor time complexity for generic operations.

      btw, i do not really see why so many people complain about swing performance. using 1.4.2, it runs as smooth as a native app on an amd 630mhz pc. the only bad thing is the jfileselector which no one should use, take the native awt dialog.

      I'll admit, Swing runs fairly quickly, but the problem isn't Swing performance, it's Java performance. Java is slow as molasses at any kind of complex computation, and furthermore bloats the memory to a really ridiculous degree. Just running a program to print "Hello World" over and over again occupies several MB of RAM! This isn't an efficient language, good for prototyping, and cross platform graphics, but not for real applications.

    17. Re:Old news by zarr · · Score: 1

      you can develop cross-platform code far better in C++ with the right cross-platform libraries

      Can you please elaborate? Which libraries provide functionality comparable to the standard java class libraries? Do they run (in updated versions) on windows, linux, *bsd, mac, aix, solaris, hpux, and irix?

      I'm not saying java is flawless, but as far as I can see, there is only one reason to use c/c++ instead of java: Speed. But, 99% of the time that is a non-issue anyway. I doesn't matter if the processing takes 1ms or 10ms when you must wait a second for IO anyway...

    18. Re:Old news by Anonymous Coward · · Score: 0

      Can you please elaborate? Which libraries provide functionality comparable to the standard java class libraries? Do they run (in updated versions) on windows, linux, *bsd, mac, aix, solaris, hpux, and irix?

      Qt is the obvious one. It (along with the STL, perhaps) provides pretty much all the UI, data handling, database interface and operating system compatibility shims needed for most applications.

      Qt is available for all the above operating systems. I'm supporting a fairly serious client/server application, across Windows, Solaris, Linux and FreeBSD, using Qt for both the graphical client and the server daemons, with only one OS specific #ifdef in the whole application suite (and that's only to use syslog for a few things). I'm not expecting the MacOS X build to be any more complicated.

      I'm not saying java is flawless, but as far as I can see, there is only one reason to use c/c++ instead of java: Speed. But, 99% of the time that is a non-issue anyway. I doesn't matter if the processing takes 1ms or 10ms when you must wait a second for IO anyway...

      Speed isn't the issue, really (though Java apps tend to be badly written and slow). For most apps, beyond toy apps, the runtime issues are stability (I find JVM based apps to be significantly less reliable than native apps, especially if running on a different JVM than the one they were built for) and memory footprint (JVM based systems tend to be huge memory hogs - and that can be a huge problem). Note that I didn't mention the language Java anywhere in the previous sentence.

      But the functionality and design of Java based apps tends to be poor, mostly because the vast majority of Java programmers are bad programmers - and they can afford to be, because Java is a fairly defensive bondage-and-discipline language, designed for teams of mediocre programmers. Other development environments don't allow a programmer to stay mediocre, and yet still be gainfully employed for very long.

      Most of the good java programmers I've dealt with did not learn Java as their primary language, and are good programmers in any language they choose to use. They're very rare.

    19. Re:Old news by EvanED · · Score: 1

      "...there are no suprises like operator overloading.."

      See, I *never* got this. When used properly, exactly how does operator overloading complicate reading the code? Sure, it can be abused, but I can make a function called add() that does nothing of the sort. I think
      someComplexNo = anotherComplexNo + stillAnother;
      is much more readable than
      someComplexNo = complex.add(anotherComplexNo, stillAnother);

    20. Re:Old news by newhoggy · · Score: 1
      Java has been successful because it has comprehensive well documented libraries that were written by developers with some design sense. For example, python is a nice language, but I have had an awful time working out how to do things I wanted to do because documentation is sparse and libraries cryptic and incomplete.

      I would DIE to see C++ with a well documented cross platform library as comprehensive as Java's all in a single package. (Well not literally ofcourse!) But that is a long way off because library implementors are still exploring the language's expressive power.

    21. Re:Old news by hak1du · · Score: 1

      Eiffel, Modula-3, Smalltalk-80, Simula, ObjectPascal, Turing, Clu, Cedar, Mesa, ...

    22. Re:Old news by fforw · · Score: 1
      See, I *never* got this. When used properly, exactly how does operator overloading complicate reading the code? Sure, it can be abused, but I can make a function called add() that does nothing of the sort. I think
      someComplexNo = anotherComplexNo + stillAnother;
      is much more readable than
      someComplexNo = complex.add(anotherComplexNo, stillAnother);
      An call to a method can't be confused with a syntactically identical language construct overloaded somewhere else.
      The cases in which it is nice to have this syntactic sugar are far less common than the cases where it is misused.
      --
      while (!asleep()) sheep++
    23. Re:Old news by stripes · · Score: 1
      I presume it has exception handling like C++, but hopefully better.

      I think it is pretty much identical to C++'s except you have to throw a object (well a reference to one), not a basic type. I don't know wether or not D's standard lib makes better and more consistent use of them, and has a better base class for them. That would make a big difference, even in C++ exceptions would be simpler to deal with if that were so.

      One hopes the debugger deals with them better then gdb seems to.

  5. Obligatory java response... by mogrinz · · Score: 5, Informative

    Looking at that comparison table, it's clear the author hasn't looked at Java since 1.4

    1. Re:Obligatory java response... by Nasarius · · Score: 4, Informative

      I'm as excited about the new syntactic sugar in 1.5 as the next guy, but it *is* still in beta, and therefore not quite part of the "official" language. I for one can't and won't use the new features until there's a stable 1.5 JDK.

      --
      LOAD "SIG",8,1
    2. Re:Obligatory java response... by ajedgar · · Score: 1

      Nor Groovy either...

      AJ

    3. Re:Obligatory java response... by wideBlueSkies · · Score: 3, Insightful

      I'm sure the gentleman will update his table once 1.5 comes out.

      Templates.... great. It's like C++, but it's not.

      --
      Huh?
    4. Re:Obligatory java response... by JohnnyCannuk · · Score: 1

      Of greater concern is some (purposely, I suspect) misleading statments in that list. Like the 'typeof' in the generic programming section. After reading the description of this it sure looks like the Java 'instanceof' or the old RTTI stuff from C++. Or at least it looks like something that can be implemented with a function in about 10 lines of code in either language using the Reflection API or RTTI.

      If I'm wrong, please enlighten me.

      Oh and for the 'yeah but Java is at 1.4' crowd, all of the advanced functionality that is currently in the 1.5 beta (which will likely be a full release at Java One in June) are downloadable libraries that can be used in the 1.4.x JSDK. I'd be willing to bet most of the functionality they brag about is either available as a third party library from Apache et al or isn't needed.

      Perhaps they should compare what kinds of things can currently be done with all those languages and how easy it is to do them right now, rather than focus narrowly on the language spec. There are lots of things on those lists that can be done in ALL the languages (like variable arrays -> vectors? Lists?) but aren't in the spec. Some languages make it easier to do that others...

      --
      Never by hatred has hatred been appeased, only by kindness - the Buddha
    5. Re:Obligatory java response... by radish · · Score: 1

      Not just that, there are things he's missed out from way earlier. How about no "typeof" operator? Sounds awfully like either instanceof or object.getClass() to me. Arrays of bits? Errr... boolean[] anyone?

      Where's the mention of reflection? It's an amazingly powerful mechanism built right in there in Java, but seemingly not worthy of mention.

      And I have to question the whole premise of the comparison. Java (for one, I'm sure there are others) is a language in which the libraries are _key_. The standard java.xx libs are essential to running _anything_ in the language. Hence it strikes me as somewhat unfair to mark Java down as (for example) not having resizable or associative arrays when the (super groovy) Collections framework is sitting right there with List, Vector, HashMap, HashTable and a whole bunch of other ADT goodness. Oh well.

      --

      ---- Den ene knappen er powerknapp, den andre er Bender voice knapp "Bite My Shiny Metal Ass"

    6. Re:Obligatory java response... by Anonymous Coward · · Score: 0

      Java also does support conditional compilation, at least by definition
      ( http://java.sun.com/docs/books/jls/second_edition/ html/statements.doc.html#236365 )

      I'd like to have this comparison made by Stroustroup, Sun and the others and then look at the union/intersection.

    7. Re:Obligatory java response... by kubrick · · Score: 1

      The important thing is not to stop questioning. --Albert Einstein

      Why?

      --
      deus does not exist but if he does
    8. Re:Obligatory java response... by wideBlueSkies · · Score: 1

      Why not?

      --
      Huh?
    9. Re:Obligatory java response... by kubrick · · Score: 1

      "Why do you always answer a question with another question?"

      Very Zen, or possibly Rabbinical, that Einstein chap.

      --
      deus does not exist but if he does
    10. Re:Obligatory java response... by luisdom · · Score: 1

      But the comparison is still not valid, as D is as beta as the 1.5 JDK, or more. Look at the bugs:

      * -g is not implemented, because I haven't figured out how to do it yet. gdb still works, though, at the global symbol level.
      * The code generator output has not been tuned yet, so it can be bloated.
      * Shared libraries cannot be generated.
      * The exception handling is not compatible with the way g++ does it. I don't know if this is an issue or not.
      * The compiler sometimes gets the line number wrong on an error.
      * The phobos D runtime library is inadequate.
      * Need to write a tool to convert C .h files into D imports.
      * Array op= operations are not implemented.
      * In preconditions and out postconditions for member functions are not inherited.
      * It cannot be run from the IDDE.

  6. What does D stand for? by Spiked_Three · · Score: 2, Funny

    Doom of course.

    --
    slashdot troll = you make a compelling argument I do not like the implications of.
    1. Re:What does D stand for? by TheJavaGuy · · Score: 2, Interesting
      What does D stand for?

      Here is a qoute from their website:

      "The original name was the Mars Programming Language. But my friends kept calling it D, and I found myself starting to call it D. The idea of D being a successor to C goes back at least as far as 1988, as in this thread".

      --
      Opera Watch - An Opera browser blog.
    2. Re:What does D stand for? by wideBlueSkies · · Score: 1

      From the Usenet post:

      >It is pleasantly compact, and very full of nice
      >shortcuts (e.g. "string"[i] ). If you dislike C , try other languages:
      >Fortran, Pascal, Ada ,Modula 2. Me, well , I like C and Fortran and loathe
      >the rest.


      It's interesting to see that in 14 years. The story's the same, and only the names have changed.

      Today a guy would post something like this:
      It is pleasantly compact, and very full of nice shortcuts (e.g. "string"[i] ). If you dislike C , try other languages: Perl, C++, Python ,Java. Me, well , I like C and Perl and loathe the rest.

      wbs

      --
      Huh?
  7. Sounds like a good idea by CharAznable · · Score: 5, Insightful

    I like this. It was about time someone saw the need of a cleaner, more modern version of C/C++ that takes the best features of the modern languages that are supplanting it in higher-level application development, like Java and Perl.
    However, I it is doubful it will gain a foothold in the current ocean of multiple, semi-specialized languages.

    --
    The perfect sig is a lot like silence, only louder
    1. Re:Sounds like a good idea by Kruemelmo · · Score: 2, Insightful
      What I found interesting was that they claim applications with garbage collection to be faster. I would never have expected this.

      The D approach is pretty much taking the best from C++, Java and C#, and you can find a lot the stuff you were asking yourself "why is this not possible in [insert current language]" in it. For example what they call function deletates is really missing in C++.

      However, some time will pass until a usable compiler will be available for *any* plattform.

    2. Re:Sounds like a good idea by HiThere · · Score: 1

      For now, there are only useable compilers for MSWind and Linux...unless someone has ported it to BSD while I wasn't looking.

      OK. So for now the Mac is left out. That's basically due to lack of manpower, not to any intrinsic difficulty. And if BrightD or any of the other attempts succeed, then D will be compatible with GCC, and be able to use the GCC back-end code generation. Which will immediately make it available on a large number of architectures.

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
    3. Re:Sounds like a good idea by Arjuna · · Score: 1

      Um I think 'function delegation' is really present in C++:

      http://linuxquality.sunsite.dk/articles/memberpo in ters/

      However not as graceful as the D syntax.

      We should admit the failure of the imperitive approach and go back to Common LISP.

    4. Re:Sounds like a good idea by Kruemelmo · · Score: 1

      Member pointers do exist in C++. D Function delegates are different: They contain both a pointer to an object and a pointer to a function.

      In order to call a function, with C++ member pointers you still need an object (used as the this pointer). With D member delegates, the this pointer is included in the delegate.

      Borland C++ provides a proprietary extension called __closure with is pretty much the same.

  8. Yet another by 53cur!ty · · Score: 1, Insightful
    Add another language to the list! While D does seem to offer some great features the key is adoptability. The question is , will the programming community at large use D for production systems and future development.

    I don't see D having the kind of successful adoption that Perl had/has or Python (to name two) yet neither of these were overnight successes. Only time and programmer support will tell if it has D chance!

    Where the answers are...

  9. D @ Google by Jugalator · · Score: 4, Informative

    Don't miss Google Directory if you're looking for more D info:
    Computers > Programming > Languages > D

    New programming languages are interesting, and sometimes I wonder what the next "big thing" will be. Will we have another big, revolutionizing, new concept like "object-oriented programming" that you simply must know in a near future?

    --
    Beware: In C++, your friends can see your privates!
    1. Re:D @ Google by oroshana · · Score: 1

      Well I've been using "aspect-oriented programming" for a while. It deals with code that can be extended depending on what source you overlay with each other. It's a very useful language when you are trying to develope test suites for verification of ASIC/FPGA logic. It allows you to create a basic environment, and then create a variety of smaller files that go and tweak/extend/replace parts of the environment. And the main plus is that you don't have to really "plan" for these tweaks, the language itself lets you do it. This is something that object-oriented languages didn't give me, and I ended up wasting a lot of time redesigning things. Aspect-oriented = clean-hacking. :o)

  10. try, catch, finally by 91degrees · · Score: 3, Interesting

    Wjhy do programming languages keep implementing this nasty tired interface? It's too bulky and long winded. Whereas I might just call a cleanup method if the function returns NULL, I'm actually obliged to deal with a thrown exception.

    In theory this would be an ideal solution. It forces programmers to think about what they're doing. In practice, it doesn't. Coders are too busy thinking about the actual problem. Error checking gets in the way. They end up implementing the quickest way of ignoring the problem. The result is that we're no better off than if we just checked return values. The application should be doing what the user wants. Not the other way round.

    1. Re:try, catch, finally by PotPieMan · · Score: 5, Insightful

      As you say, programmers don't want to spend time worrying about error checking. The problem with return values is that some functions return -1, some return NULL, and others return some magic number depending on the problem. You can come up with rules and standards, but these are often broken or forgotten while programming.

      Exceptions provide an obvious answer to the problem of how to handle different types of problems. If a file doesn't exist and someone tries to open it, a FileNotFoundException is thrown. If a file exists but the permissions don't allow access, an IOException is thrown.

      Exceptions also provide a MUCH cleaner way of propagating errors. If one method calls another method to open a file, and the file can't be opened, how do you tell the original caller that there was a problem? With exceptions, you simply declare that your method throws IOException, and then (typically) skip the try-catch-finally block.

    2. Re:try, catch, finally by -brazil- · · Score: 1
      In theory this would be an ideal solution. It forces programmers to think about what they're doing. In practice, it doesn't. Coders are too busy thinking about the actual problem. Error checking gets in the way. They end up implementing the quickest way of ignoring the problem. The result is that we're no better off than if we just checked return values.


      So what you're saying is that if the programmer is lazy, it's no better than return values? I'd say that it ends up better even then, most of the time (if the programmer wasn't downright incompetent and at least outputs the stack trace somewhere), but most importantly, it makes it much easier not to be lazy, and leads to cleaner code when you're not.

      --

      The illegal we do immediately. The unconstitutional takes a little longer.
      --Henry Kissinger

    3. Re:try, catch, finally by Anonymous Coward · · Score: 1, Informative

      Catching a NULL value, a -1, 0, 1, 89, -999, -5000 or any of the other 4+ billion possibilities can only convey so much information and in the end you're still left guessing as to what really went wrong. Exceptions, on the other hand, automatically relay this information.

      In .NET specifically each Exception contains the description, a full stack trace back to the source of the error (if you compile with debugging the line number is included) and any exceptions that may have resulted in that exception being thrown. As such I have a detailed account of what went wrong so that I can address it specifically.

      Furthermore, at least in .NET, there are several ways to catch exceptions that were not explicitly caught by the code in a try...catch...finally block. I could marshal all unhandled exceptions to a function that logs the error in a file, shoots out a detailed error message with full stack and state information over SMTP, explains the problem to the user in laymen's terms and then returns the application to an idle state.

    4. Re:try, catch, finally by JM_the_Great · · Score: 1

      I'd say it's only a problem when you get in the habit of:

      try { ... do stuff ... }
      catch (Exception e) { }

      just so the code compiles quickly, assuring yourself you'll go back later and make it right... but then you never do.

      --

      --Justin Mitchell
      "2nd Place is a fancy word for losing" --Bender (Futurama)
    5. Re:try, catch, finally by drxenos · · Score: 1

      First off, if error recovery is not part of your design, you are a pretty shitty-ass programmer. Secondly, exceptions are much easier and cleaner to deal with than return codes. By providing an alternate path for errors, exceptions alleviate the need to check the return value of every function call, and the need to then implement many, many paths in your code to skip sections once an error is found. Exception don't have to be handle immediately at the return point, they can be delayed (scope-wise) until a point where is makes sense. Plus, debugging is much simpler. Without multitude error control paths in the code, path converage is easy.

      --


      Anonymous Cowards suck.
    6. Re:try, catch, finally by 91degrees · · Score: 1

      So what you're saying is that if the programmer is lazy, it's no better than return values?

      Well, yes, more or less, but I seem to have skipped over my key point, which is that we need a new method, that has the same flexibility as try, catch, but is a lot more terse.

    7. Re:try, catch, finally by Sigma+7 · · Score: 1
      They end up implementing the quickest way of ignoring the problem. The result is that we're no better off than if we just checked return values.
      True, but in this case it's explicitly the developer's fault for lousy error checking. While not checking for a return value can be dismissed as an "edit and recompile" type of error, there is absolutly no excuse for a developer's lazyness for botching exception handling.

      If the developer wants to handle error checking later, the proper procedure is to place a "TODO" marker into a pseudo-error handling routine so that he can return to it later (after solving the rest of the problem.) Failing to do even that indicates that the developer hasn't even solved the basic problem in the first place.

    8. Re:try, catch, finally by david.given · · Score: 2, Interesting
      Exceptions are wonderful --- in garbage collected languages. In languages with manual memory allocation, they're a pain.

      The problem is that exceptions short-circuit the return path in non-obvious ways. Say we have a chain of functions a calling b calling c. c throws an exception. a catches it. Does b need to care?

      Well, yeah, if b allocates some memory that needs to be freed on an error condition. It needs to catch the exception, clean up, and rethrow --- work that needs to be done whether you're using exceptions or not. And using exceptions usually results in more and more complex code than just returning an error code.

      C++ attempts to get around this by calling the destructors of any auto variables on the stack as it works its way up the return path. This works great, except when dealing with pointers, which still need to be done manually. It may be possible to do something scary with smart pointers and templates, but that is, as I said, scary.

      (Part of the problem with C++ is that it's such a huge language that it's only possible to thoroughly know and use a subset of it. I don't doubt that there are ways of using exceptions with dynamically allocated memory safely... but I don't know them, and every time I've tried to find out, I've come back with a headache and a renewed determination not to use exceptions. The only time I've ever actually used the things was in a daemon that deliberately did not dynamically allocate anything, and they were brilliant. YMMV.)

      But in a garbage collected language, you don't have to worry about this sort of cleanup except in very rare cases, and it all works very nicely. Anything b allocates will be orphaned and just vanish, magically.

    9. Re:try, catch, finally by 91degrees · · Score: 1

      First off, if error recovery is not part of your design, you are a pretty shitty-ass programmer.

      There are a lot of shitty ass programmers. The language should facilitate them being able to add error recovery in a simple, elegant way.

      Secondly, exceptions are much easier and cleaner to deal with than return codes.

      Depends on the error. The exceptions mechanism requires a lot more typing and debugging that returning NULL if the function returns NULL. But why is the choice limitted to return codes and exceptions? Isn't there a middle ground?

    10. Re:try, catch, finally by Anonymous Coward · · Score: 0

      First off, if error recovery is not part of your design, you are a pretty shitty-ass programmer.

      Because I do use exceptions, does that make me a clean-ass programmer?

    11. Re:try, catch, finally by 91degrees · · Score: 1

      Yes, it is the programmer's fault. Given the number of programmers that do this, perhaps it's time the language designers came up with a way to prevent this from being a problem, much like they did with garbage collection in Java.

    12. Re:try, catch, finally by drxenos · · Score: 1

      Depends on the error. The exceptions mechanism requires a lot more typing and debugging that returning NULL if the function returns NULL. But why is the choice limitted to return codes and exceptions? Isn't there a middle ground?

      I would argue that checking return codes is, in the end, more typing. But I also would not weigh the correctness of the mechanism I use by the amount of typing required. I don't think it should be return codes vs exceptions vs what-else-is-there. It shouldn't be all or nothing. Use what is appriopriate for the situation. I think it would depend on what you plan to do after you get that NULL return. If your code can continue on the same general path, then fine. But, if you need to escape from that path completely, then exceptions are more appriopriate. They are also better for handling erroneous conditions when you are several scopes (both blocks and function calls) in and need to exit them immediately.

      --


      Anonymous Cowards suck.
    13. Re:try, catch, finally by Doomdark · · Score: 1
      In theory this would be an ideal solution. It forces programmers to think about what they're doing. In practice, it doesn't. Coders are too busy thinking about the actual problem. Error checking gets in the way. They end up implementing the quickest way of ignoring the problem.

      Are you by any chance just generalizing based on YOUR behavior here? I have no stastical sampling, but I have no trouble using exception-based systems in Java just nice, nor do my team members. I agree that C++ has its own clunky version that's not quite as useful, being half-assed bolted-in bastardization of general concept, but most other languages (Java, C#, not to mention languages more favored by academia) have reasonably straight-forward implementations.

      I disagree with try ... catch being useless or worse than simple old return error code approach. Maybe there are better solutions -- if so, hopefully someone presents it soon. But until then, try/catch works just fine in Java, for my purposes. From what I've seen, people who ignore errors propagated via exceptions, would be as unlikely to check for special error codes as well.

      As to your "simple" check-for-NULL approach, that's just load of bull. With error codes one ends up having to use gotos; being unable to pass exception straight (ie. having to properly propagate error codes up the stack), maybe have to use specific error handler pointers (to emulate exception handling), and so on. It works ok in some simple situations, but is a real bitch to scale. With error codes it is tricky to separate generic (shared) but error type specific handling; something easy in languages with exception-based handling. With things like separation of checked and unchecked exception, it's also very easy to make high-level catch-all handling of nasty problems like null pointer/array index out of bounds, so that program does not have to terminate. And that's a real boon for long-running server processes (esp. with ones that allow modular plug-ins to be dynamically loaded); you want to log and fix problems, but not terminate your business critical system; this without having to declare or handle such problems at low level code. Try to do that with error codes.

      Finally, no one forces you to use exception-based error handling in most languages. You can choose to use your trivially simplistic error code approach if you so choose.

      --
      I like paying taxes. With them I buy civilization -- Oliver Wendell Holmes
    14. Re:try, catch, finally by Rakshasa+Taisab · · Score: 1

      The problem is that exceptions short-circuit the return path in non-obvious ways.

      It is done in a quite obvious way if you've spendt the nessesary time to learn it. Handling deallocation pointers during an exception isn't hard as long as you know how it's done. Like any other aspect of real programming languages, as long as you are carefull then it won't bork;)

      --
      - These characters were randomly selected.
    15. Re:try, catch, finally by 91degrees · · Score: 1

      Are you by any chance just generalizing based on YOUR behavior here?

      Nope. I use return codes where needed. Generally speaking, all I want to do is retry, quit, or carry on anyway.

      With error codes one ends up having to use gotos; being unable to pass exception straight (ie. having to properly propagate error codes up the stack), maybe have to use specific error handler pointers (to emulate exception handling), and so on.

      I've never had to use goto. Nor do I need to handle pointers. Nor do I want this degree of error checking compiled into my code. The debugger should deal with this. The end user has no use for it.

      it's also very easy to make high-level catch-all handling of nasty problems like null pointer/array index out of bounds, so that program does not have to terminate.

      Surely the program should check that the input isn't going to produce an array out of bounds error. I use ASSERT on this sort of bug, and catch them before they find their way into released code.

    16. Re:try, catch, finally by KagakuNinja · · Score: 1
      C++ attempts to get around this by calling the destructors of any auto variables on the stack as it works its way up the return path. This works great, except when dealing with pointers, which still need to be done manually. It may be possible to do something scary with smart pointers and templates, but that is, as I said, scary.

      There is nothing scary about auto_ptr. If you think this is scary, then you should be working in a different language than C++.

      Thing* t = new Thing();
      auto_ptr<Thing> ap(t);


      See? that wasn't so bad...
    17. Re:try, catch, finally by ckaminski · · Score: 1

      One character is all that separates auto_ptr from being a horrible nuisance:

      class Thing { };

      int a(auto_ptr<Thing> abc) { ...
      }
      int b(auto_ptr<Thing>& abc) { ...
      }

      int main(...) {
      auto_ptr<Thing> ptr(new Thing);

      a(ptr);
      b(ptr);
      }

      A simple typo, but one that *WILL* result in a NULL pointer exception.

      Can you guess what the typo is? ;-)

    18. Re:try, catch, finally by Anonymous Coward · · Score: 0

      No. Exceptions are the work of the devil. Allways catch exceptions and never throw is the only safe philosophy when it comes to exceptions. Exceptions seem like a good idea to novice programmers, but the thing is you can never trust code that throws exceptions and then you are forced into try/catch(ing) everything.

      Exceptions get worse if you have non-trivial destructors. What happens if during the course of unwinding the stack from the exception you threw, another exception is thrown ?? I tell you what happens, your program falls flat on its ass thats what.

      For the sake of everyone who may have to come after you and clean up your nasty code, don't throw exceptions. Just return an error code and let the caller decide what if anything to do with it.

      Fact is an uncaught exception crashes your program. And do you trust the other programmers you work with to catch every exception that gets thrown ? I don't. For the love of god, please stop throwing them.

    19. Re:try, catch, finally by KagakuNinja · · Score: 2, Informative
      To program effectively in both C and C++, you have to develop consistent rules, to keep you r code manageable. One such rule is, always pass smart pointers by reference; this avoids the unnecessary construction and destruction of a temporary. Of course, I almost never write functions that accept auto_ptrs as parameters. Conceptually, you don't to pass an auto_ptr to a function like you are doing.

      The purpose of the auto_ptr is to provide temporary ownership of an allocated object. I would have coded your example like this:
      int a(Thing *) {
      ...
      }

      int b(Thing *) {
      ...
      }

      int main(...) {
      auto_ptr<Thing> ptr(new Thing);

      a(ptr.get());
      b(ptr.get());
      }
    20. Re:try, catch, finally by KagakuNinja · · Score: 1

      But in a garbage collected language, you don't have to worry about this sort of cleanup except in very rare cases, and it all works very nicely. Anything b allocates will be orphaned and just vanish, magically.

      This is true. However, the lack of destructors in a language such as Java means that you have to make sure to put in a lot of try..finally statements to insure that files get closed properly, cursor states get reset properly, and so on. These things can easily be done in C++ using objects on the stack. Maybe C# and D this handle better somehow, I don't know.

    21. Re:try, catch, finally by zarr · · Score: 1
      Empty catch blocks... ARRRGHH!!!!!!!!

      (Lameness filter: "Don't use so many caps. It's like YELLING." Yes, that was exactly the effect I was looking for!)

    22. Re:try, catch, finally by ckaminski · · Score: 1

      Even your option is fraught with potential error. A simple:

      int b(Thing *ptr) {
      auto_ptr<Thing> aptr(ptr); ...
      } ...

      Thrown in carelessly screws the pooch. I would personally prefer a refcounted or encapsulated smart_ptr vs. an auto_ptr. I like to keep my pointers consistent. A rule such that you have requires knowing that ptr.get() is a managed pointer, so that if you have to resize or prematurely delete it, you're updating the manager properly. It's inconsistent, and fraught with peril if your working with numerous developers.
      Double deleting a pointer has always been an undefined C++ operation, no?

      I'm not trying to bash your practice although it kind of looks like it. I'm only bashing auto_ptr. :-) You *ARE* right, if you always pass a smart_ptr by reference you eliminate the risk. It only takes one moron on your project to leave off that & in the function prototype to cause you a weeks worth of HELL, though.

      Personally, I think auto_ptr only got added to the standard so that people could feel safe knowing that dynamically allocated memory would get freed during stack traversal on an exception. I don't think it was *EVER* intended to be used except as you described in your post.

      Cheers.

    23. Re:try, catch, finally by KagakuNinja · · Score: 1

      There is nothing wrong with what you are saying, but the identical problem exists in C. If you free() a pointer twice, you are just as screwed. In C, you have to develop rules to know when a pointer should and should not be free'd.

      auto_ptr is no more error prone that conventional memory mamangement; if you have a proper set of coding standards in your organization, then they are fantastic at reducing the complexity of memory management.

      In the final analysis, pointers are hard. That is why languages like Java don't have them.

    24. Re:try, catch, finally by ckaminski · · Score: 1

      While I don't disagree with you on your C/free example, I tend to disagree with you specifically on auto_ptr. It's billed to newbies, experts, and everyone in between as a panacea, when indeed it has pitfalls to trap the unwary.

      I think can agree that references are by far a much better mechanism for the majority of problems pointers try to solve. :-)

    25. Re:try, catch, finally by Doomdark · · Score: 1
      I've never had to use goto.

      Often C/C++ code uses gotos to go to shared cleanup code, from various error check conditions; to keep allocation/access and cleanup in same method. If you don't use it, you'll use some other mechanism to same end (note, too, that I have nothing against use of goto in this way -- it is one of valid uses of it in C).

      Nor do I need to handle pointers. Nor do I want this degree of error checking compiled into my code. The debugger should deal with this. The end user has no use for it.

      User often may not need to see it, but no, debugger certainly isn't going to solve it. Exceptions can occur for perfectly fine programs (network timeouts, remote end crashing, running out of some resource such as memory or disk space, another process accidentally changing file permissions etc. etc. etc). Without generic extension mechanism, every single method would need to be able return any indication of abnormal circumstances. Plus, without higher-level catch blocks, you'd have no choice but check at lowest level code all however remote problem cases, if you want to make high-availability system.

      And although program definitely should check for expected error conditions (bounds checks, nulls), it's like saying acrobats should never use nets -- they only needed if they fall, and good one shouldn't fall. Asserts, logging problems are good too, but exceptions are eventually necessary for high-availability (server) systems.

      One final note; in some languages (notably Java), one minor benefit of exceptions is also that this way you need not waste return value on error/success condition marker: you can return whatever normal value is, and just signal error conditions using exceptions. Without exceptions code would be pretty clumsy.

      --
      I like paying taxes. With them I buy civilization -- Oliver Wendell Holmes
    26. Re:try, catch, finally by Anonymous+Brave+Guy · · Score: 1
      The problem is that exceptions short-circuit the return path in non-obvious ways. Say we have a chain of functions a calling b calling c. c throws an exception. a catches it. Does b need to care?

      No. If b needs to care, it should be catching (and possibly rethrowing) the exception itself. The RAII idiom in C++ evolved precisely to handle the situation where b needs to do action as a side effect of control leaving it, but without caring about the specifics of the exception causing that to happen.

      It may be possible to do something scary with smart pointers and templates, but that is, as I said, scary.

      No it's not, it's absolutely routine, and page 1 of the smart pointer manual. If you don't grok this, I can understand why you don't like exceptions, but that's an understanding/education issue, not a problem with the exception concept.

      But in a garbage collected language, you don't have to worry about this sort of cleanup except in very rare cases, and it all works very nicely.

      On the contrary, I think it's far more dangerous in a GC'd language. The most common problem of resource management amongst those who rely on GC is complacency: because they can't leak memory, they forget the basic principles of resource management, and consequently leak just about everything else. Most of the major GC'd languages in the family don't have deterministic destruction semantics, so RAII is out, and if you want timely resource release then now you have to write finally blocks everywhere. That is certainly not an improvement in either readability or robustness!

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    27. Re:try, catch, finally by corngrower · · Score: 1

      My problem with C++ style exceptions is that often times I do not have the documentation for a function I'm calling that specifies what exceptions it can throw, and under what conditions it throws the exceptions. Sometimes there are these exceptions are thrown for things I could be handling in the calling function. And because I don't know what the exceptions the called functions can raise, I'm unable to provide documentation on what exceptions my own function can raise. C++ style exceptions are half-assed. Java did a much better job. You handle the exceptions generated by any called functions or you explicitly specify that you re-throw those you don't handle.

  11. Summary by TheJavaGuy · · Score: 5, Informative

    D drops archaic C++ features like the preprocessor and forward declarations. It adds modern features like design by contract, unit testing, true modules, automatic memory management, first class arrays, closures, and a reengineered template syntax. D retains C++'s ability to do low level coding, and adds to it with support for an integrated inline assembler. C++ multiple inheritance is replaced by single inheritance with interfaces. D's declaration, statement and expression syntax closely matches C++.

    --
    Opera Watch - An Opera browser blog.
    1. Re:Summary by andy55 · · Score: 2, Insightful

      D drops archaic C++ features like the preprocessor

      I'm a veteran C/C++ dev, and when I saw this I went cock-eyed. Macros are essential if you have a performance-critical section that has very redundant portions (that can otherwise be maintained with just a single macro called many times). If D has it's way, I suppose it'd want a dev to write a proc to replace his macro in this a situation--are they kidding? It'd be a turkey shoot for the compiler to it screw up the inlining (without you knowing about it), so you're getting non-optimal execution.

      I've wondered why so many Java finatics, Sun, and now D finatics are so anti-macros. It's a real mystery to me--and it's not like they're significant for the compilers to implement and maintain--macro implementation for a preprocessor is nothing next to their C/C++ compiler. If you have piss-poor dev abuse macros, shame on the dev, not on the language.

    2. Re:Summary by WalterBright · · Score: 1

      It turns out that D's nested functions handle quite nicely the macro use of factoring out performance critical redundant code in a function. They are subject to inlining by the compiler, and so produce every bit as good code as a macro, without all the problems macros have (like no scoping, no declarations, side effects of parameters, etc.).

    3. Re:Summary by Anonymous Coward · · Score: 0

      I can't speak to java, but for C/C++ macros suck because it splits the parse table into to pieces: preprocesor and compiler. You can get the same results without a preprocessor by have a compiler that a) understands inline functions, b) understands overloaded functions. As a bonus, I want my compiler to c) understand overloaded functions with different arguments and d) return complex data structures.

    4. Re:Summary by Chacham · · Score: 1

      integrated inline assembler

      Assembly. The assembler "assembles" the assembly code.

  12. Looking forward to job ads by swapsn · · Score: 5, Funny

    Looking forward to job ads saying :
    • 10+ years of C#,Java programming experience
    • 10+ years Windows 2000 experience
    • 10+ years programming experience in D

    Duh !!
    1. Re:Looking forward to job ads by doublem · · Score: 2, Interesting

      You laugh, but I was turned down for a job in 1998, because I didn't have the "5+" years in Windows 95 that they wanted.

      --
      "Live Free or Die." Don't like it? Then keep out of the USA
    2. Re:Looking forward to job ads by Anonymous Coward · · Score: 0

      Just think, now you have almost 10 years of experience of windows95 so you can get that job if you wanted to :)

      I laught cause sadly I know its true. I'm just waiting for the day when a company posts "if you are not superman, you need not apply"

    3. Re:Looking forward to job ads by Anonymous Coward · · Score: 0

      Duh, but you only would need 5+ years to know D as well as C# (in 10+ years).

  13. D already exists? by Anonymous Coward · · Score: 3, Interesting

    I remember reading something in a C book years ago about the existence of the language D, which was supposed to be an evolution of the C language, the book even specified some of the added benefits of D, this was before DigitalMars even started on D. I also know of a language called "E" on the Amiga, which was a C++ derivate and was explicitely not called D because D already existed, and I'm _not_ talking of DigitalMars' flavor. In fact I once mailed this to DigitalMars but never got a reply.
    Can anybody confirm this in any way?

    p.s. If I'm not mistaken there's also an "F", based on Fortran if I'm not mistaken.

    1. Re:D already exists? by JPM+NICK · · Score: 1
      MS is coming out with a language called F#. It is going to be a functional language. It is said to be

      Combining the safety and productivity of ML and Caml with the libraries, tools and cross-language working of .NET

      Extremetech had an article on it a while back F#
    2. Re:D already exists? by Anonymous Coward · · Score: 0

      Find Amiga E here: Amiga E

    3. Re:D already exists? by Anonymous Coward · · Score: 0

      MS is coming out with a language called F#. It is going to be a functional language. It is said to be [... c]ombining the safety and productivity of ML and Caml with the libraries, tools and cross-language working of .NETAAARGHHHH!
      AAARGHHHH!
      AAARGHHHH!

      There is no god.

  14. Why are they making it C compatible by Anonymous Coward · · Score: 1, Insightful

    I can understand many of the goals D is trying to achieve and like many of the features they have listed. However, I am surprised that D wants to be C compatible. IMHO, that has been the biggest problem with C++, it totally violates the thinking of the object oriented coder.

  15. Unneeded history by xoran99 · · Score: 4, Insightful
    From the article:

    D is designed to address the shortcomings of C++. While a powerful language, years of history and unneeded complexity has bogged down that language. They want to overcome C++'s "history" while still maintaining C compatibility. Suddenly, I'm confused.

    --

    Karma: Bad (mostly due to all those "In Soviet Russia" jokes)

    1. Re:Unneeded history by Ctrl-Z · · Score: 1

      C++ is not C. Does that help?

      --
      www.timcoleman.com is a total waste of your time. Never go there.
    2. Re:Unneeded history by Kruemelmo · · Score: 0, Redundant

      The article is wrong. D is not at all C compatible. See Programming in D for C Programmers

    3. Re:Unneeded history by Anonymous Coward · · Score: 0

      You can link to C libraries even though you can't compile C code with D.

  16. A, B, C, D, ... R! by KjetilK · · Score: 4, Funny

    Bah, We've allready made it all the way to R!

    --
    Employee of Inrupt, Project Release Manager and Community Manager for Solid
    1. Re:A, B, C, D, ... R! by djeaux · · Score: 1
      Bah, We've allready made it all the way to R!

      Well, as we see in the very next post (or the one right above this one), it stands for "Rupert."

      --
      "Obviously, I'm not an IBM computer any more than I'm an ashtray" (Bob Dylan)
    2. Re:A, B, C, D, ... R! by Anonymous Coward · · Score: 0

      Bah, We've allready made it all the way to R!

      Bah-bah, since R is based on S it is simply a case of traversing the available single letter vector from the other direction.

      This implies that all major programming languages will eventually converge on M, which is the descendant of MUMPS. (Massachusetts University Multi-Programming System, from the days fo the original _Yahoo Rots!_ magazine, ca. 1966.)

      BTW, did _Yahoo Rots!_ survive the "priest pulls rabbit from chalice" cartoon? I thought it was a great cartoon, but then I am not, and I have never been, part of the Boston Catholic community.

    3. Re:A, B, C, D, ... R! by Anonymous Coward · · Score: 0

      > Bah, We've allready made it all the way to R!

      Which is itself GNU's answer to S. Guess they're in-filling a little.

  17. What a good choice of name! (sarcasm intended) by OwlWhacker · · Score: 2, Funny

    Sheesh. You'd have thought they'd come up with a name that's a little more interesting than "D".

    No, I'm not going to suggest that it should have been called "Rupert".

    1. Re:What a good choice of name! (sarcasm intended) by Anonymous Coward · · Score: 0

      Well, would "DD" be a better name? And as far as obscure references go, how about "Wesley"?

  18. Hmm by Lank · · Score: 2, Interesting

    Well, while the addition of a garbage collection mechanism sounds appealing, it also sounds a little bit scarey when dealing with low-level code. Additionally, D has no macro preprocessing. I know some people out there consider this a feature, others will consider it a failing. However, I do think it's awesome in that it has STL-like data structures somewhat built in - STL saves a ton of time and code, regardless of whether or not you like it.

    --
    Gotta get me one of these!
    1. Re:Hmm by ViolentGreen · · Score: 2, Interesting

      Additionally, D has no macro preprocessing. I know some people out there consider this a feature, others will consider it a failing.

      You have to remember that this language is still in development. A preprocessor can be added as a step after a standard is developed. Many older languages had preprocessors added as an optional compiler pass. I believe g77 even has one for FORTRAN though it's been a while since I used it.

      --
      Not everything is analogous to cars. Car analogies rarely work.
  19. What about C++0x? by Jezral · · Score: 3, Interesting

    What happened to C++0x?

    Last I heard about that was in this Slashdot story from 2001...exactly 3 years ago, nearly to date.

    But that was supposed to be the next official holy grail, no?

    1. Re:What about C++0x? by Anonymous Coward · · Score: 0

      That caused a parsing error for me.

    2. Re:What about C++0x? by Anonymous Coward · · Score: 0

      Two meetings annually, technical report on library extensions is currently in draft and publicly available (N1647), dozens of people showing up. Have a look at C++ 2004 papers, just this year there have been 88 contributions. Another measure is also telling. Boost is serving as a testbed for the new library features, and its mailing list easiliy has dozens of postings daily. C++0x will get these features, but only after they have been field-tested.

  20. Toss out C. by iwadasn · · Score: 1, Interesting


    Guys, it's time to face the facts. C is a relic from a time when compilers were stupid. Declare all your variables before executing code, declare all your functions before using them, include headers that almost invariably break one another, hurrah.

    I'm so glad that every time I write C I get to write each function signature several times, that's lovely. In addition, C takes much more time to compoile than Java/C# because all the stupid headers take forever to parse.

    Now on to preprocessor macros. They are useful in statically compiled languages, but in dynamic (VM based) languages they are less than useless. The VM will take any code that it can and inline it, propagate constants, etc.... Macros are not needed.

    Thirdly, pointers and "suggested" types. I say suggested because the type system isn't enforced, why bother with types at all if they don't mean anything. Pointers are a problem because they allow unsafe code that forces the hardware to make up for lack of security in the software. Repeat after me, security is a software problem. Memory protection is also a software problem. The modern computer throws away about 30% of its performance on various protection schemes. More than enough to make up for using a language like Java or C#.

    So, in conclusion, C compatibility is a bug, not a feature.

    1. Re:Toss out C. by Xugumad · · Score: 1

      C has its uses, especially where you need extremely high-speed code. Particularly the wierder stuff, like using function pointer arithmetic to improve performance, or highly-specific optimised binary search tree implementations. Now, neither of these cases is exactly every day stuff (or in fact a good idea unless you know exactly what you're doing), and I'm quite happy writing most of my code in Java, but when we're trying to do complex statistics across gigabytes of data, C really is the best language for the job.

    2. Re:Toss out C. by endx7 · · Score: 2, Informative

      Guys, it's time to face the facts. C is a relic from a time when compilers were stupid. Declare all your variables before executing code, declare all your functions before using them, include headers that almost invariably break one another, hurrah.

      I'm so glad that every time I write C I get to write each function signature several times, that's lovely. In addition, C takes much more time to compoile than Java/C# because all the stupid headers take forever to parse.

      What will you use for your low level device drivers? Or how about that code that needs run fast? I don't know about compile (C does compile faster than C++ though), but C runs faster than java and C# (only -sure- about the first one). In fact, the java virtual machine and compiler are both written in C. Face it, C isn't dead yet, even though people have been trying to say so for years.

      So, in conclusion, C compatibility is a bug, not a feature.

      Other posts have mentioned this is -link- compatibility. Remember, D is meant to live in the real world as a binary outside of a vm. Link compatibility becomes a pretty damn useful thing when you need to work with other people's libraries.

    3. Re:Toss out C. by Anonymous Coward · · Score: 4, Insightful

      First off, it's link compatability with C. Secondly, no matter how archaic/simple/boneheaded you find C it's still the lingua franca of systems. More so, any system without any link level compatability with C is not really that useful.

    4. Re:Toss out C. by Jorrit · · Score: 3, Insightful

      I believe it all depends on what you want to do. For most system software (where security is very important) I would agree with you. Also for big application software (like word processing and stuff like that) I would also tend to agree.

      However, I'm not sure I agree for software where security is little or no concern but speed is the main issue. One example of that kind of software is games. I'm author of a 3D engine in C++ and I also program in Java for a living. I think that for things like these low-level languages like C and C++ are still the way to go. You can argue that computers are getting faster and faster. But user expectations about what those games can do are also constantly rising.

      Greetings,

      --
      Project Manager of Crystal Space (http://www.crystalspace3d.org). Support CS at http://tinyurl.com/cb3x4
    5. Re:Toss out C. by TheAncientHacker · · Score: 1
      Guys, it's time to face the facts. C is a relic from a time when compilers were stupid.

      Nah. C is a relic of a quick and dirty PDP assembler thrown together with no intention of making a really serious language and designed to deal with a limited set of problems. When C came out, it had been years since compilers had been that stupid.

      I mean, really folks, look at any history of computer languages and you won't see a design that stupid since the early 1960s.

    6. Re:Toss out C. by St.+Alfonso · · Score: 2, Informative

      OK, let's take your advice. No more C. Goodbye Unix - OS kernel written in C. Goodbye interpreted languages like Perl, that have their interpreter written in C. Goodbye device drivers. Most of these are written in C. Have fun re-writing all these things in D/Java/whatever.

    7. Re:Toss out C. by m.koch · · Score: 3, Insightful
      Now on to preprocessor macros. They are useful in statically compiled languages, but in dynamic (VM based) languages they are less than useless. The VM will take any code that it can and inline it, propagate constants, etc.... Macros are not needed.

      I think this is more or less a wishlist, at least concerning Java. E.g. using a method in a loop condition has dramatic impact on performance. The Java VM does not determine if a method has no side effects.
      Also there is more to a preprocessor than macros.

    8. Re:Toss out C. by happyfrogcow · · Score: 4, Insightful

      Declare all your variables before executing code

      Leads to cleaner code, in my opinion. C++ doesn't require you to do it, but I still do.

      declare all your functions before using them

      What's the big deal about this? If your tired of typing, you either need to learn to copy/paste, use an IDE that will generate code for you, or find a new industry.

      C takes much more time to compoile than Java/C# because all the stupid headers take forever to parse.

      Ever hear of "Make" and "Makefiles"? You don't need to keep recompiling things than havn't changed.

      Pointers are a problem because they allow unsafe code that forces the hardware to make up for lack of security in the software. Repeat after me, security is a software problem.

      Pointers, in some capacity, are needed for low level programming. If you don't need access to hardware, then you might have a reason to consider something besides C.

    9. Re:Toss out C. by hak1du · · Score: 1

      Leads to cleaner code, in my opinion. C++ doesn't require you to do it, but I still do.

      Clean if you are a neat freak who likes to line up his socks, but not safer or more readable. Following "declare on first use" makes unitialized variables much less likely. Furthermore, it can make a huge performance difference in some cases.

      Pointers, in some capacity, are needed for low level programming. If you don't need access to hardware, then you might have a reason to consider something besides C.

      C doesn't give you access to hardware; many C implementations happen to give you low-level features through unportable reinterpretations of illegal uses of standard constructs, resulting in one of the worst schemes for low-level programming in existence: it's unportable and you can't even tell where it's being used.

      The "pointers in some capacity" feature can be provided far more safely and just as efficiently using a collection of named primitives (unsafe_get_byte_at, unsafe_put_float_at, etc.), something just about any language and compiler can add if they choose to.

    10. Re:Toss out C. by slamb · · Score: 1
      > > Guys, it's time to face the facts. C is a relic from a time when compilers were stupid. Declare all your variables before executing code, declare all your functions before using them, include headers that almost invariably break one another, hurrah.

      > > I'm so glad that every time I write C I get to write each function signature several times, that's lovely. In addition, C takes much more time to compoile than Java/C# because all the stupid headers take forever to parse.

      > What will you use for your low level device drivers? Or how about that code that needs run fast?

      You're complaining about the virtual machine aspect of most high-level languages (not D). And the garbage collector of most high-level languages (including D). You haven't addressed his criticisms of C at all. (And how could you? He's absolutely right.)

      If this is your only concern, you could easily come up with a language (D-, maybe? ;) that is like D except that it has delete instead of a garbage collector. And then implement smart pointers as in C++. It would have none of the deficiencies of C/C++ that the grandparent mentioned.

    11. Re:Toss out C. by Anonymous Coward · · Score: 0
      Leads to cleaner code, in my opinion. C++ doesn't require you to do it, but I still do.
      Clean if you are a neat freak who likes to line up his socks, but not safer or more readable. Following "declare on first use" makes unitialized variables much less likely. Furthermore, it can make a huge performance difference in some cases.
      I agree with the grandparent, declaring variables at the beginning does make for cleaner code. And for those rare times when it makes a "huge performance difference", you can just add an extra level of curly braces! (Of course, I use C(not ++), so I HAVE to do this - so what do I know?)
    12. Re:Toss out C. by Pedrito · · Score: 1

      Ever hear of "Make" and "Makefiles"? You don't need to keep recompiling things than havn't changed.

      Not true. Make a small change to a header used by all files in your project, and everything gets recompiled. That's why C/C++ can be so slow to build. By getting rid of header files altogether, this issue goes away, and boy, does it ever make a difference.

    13. Re:Toss out C. by Anonymous Coward · · Score: 0

      Declare all your variables before executing code, declare all your functions before using them

      This actually helps to ensure correct and clear code. You tell the compiler what you intend to do, and it whines at you if you do something else instead.

      include headers that almost invariably break one another

      Haven't had that experience, at least not for many years.

      In addition, C takes much more time to compoile than Java/C# because all the stupid headers take forever to parse.

      If you say so... But never mind that Java and C# only do half of their compiling at compile time. (not half in the mathematical sense, of course)

      Now on to preprocessor macros. They are useful in statically compiled languages, but in dynamic (VM based) languages they are less than useless.

      You just try tearing macros from the hands of lisp and scheme programmers. They're a vastly different sort of macro, of course, but deep down they do the same job.

      Thirdly, pointers and "suggested" types. I say suggested because the type system isn't enforced, why bother with types at all if they don't mean anything.

      Use C++.

      Pointers are a problem because they allow unsafe code that forces the hardware to make up for lack of security in the software. Repeat after me, security is a software problem.

      The problem with pointers, as with much of the rest of C, is that they're hard for novices. Experienced and skilled programmers can deal with pointers and memory allocation with no trouble. But then these experienced and skilled programmers are pretty rare and expensive.

      Now the problem with using novice programmers and a big net is that they still don't know anything about security and memory usage. You can't abstract away security. Ok, so you don't have buffer overflows, but all your passwords are sent across the network as plain text? Not good.

      Memory protection is also a software problem.

      Not inherently, no. If you didn't have pointers that can point to arbitrary locations, you wouldn't need memory protection. (and I would gladly give up pointers if it made that possible)

      But in practice, programs will still manage to suck. And you can't get all of the benefits without rewriting everything on the system.

    14. Re:Toss out C. by master_p · · Score: 1

      "C takes much more time to compoile than Java/C# because all the stupid headers take forever to parse."

      "Ever hear of "Make" and "Makefiles"? You don't need to keep recompiling things than havn't changed."

      No!!! each time the C compiler meets a a header that it is not yet parsed, it is parsed and added to the current symbol table...this takes time, especially on big headers like "windows.h".

      D is the correct way, which is also the Java's way: to import the symbols, instead of re-making them each time a particular piece of code is re-compiled.

      Microsoft's pre-compiled headers is a partial solution.

      Makefiles have nothing to do with the header parsing.

    15. Re:Toss out C. by Anonymous Coward · · Score: 0
      C takes much more time to compoile than Java/C# because all the stupid headers take forever to parse.

      Ever hear of "Make" and "Makefiles"? You don't need to keep recompiling things than havn't changed.


      It seems you don't understand the concept of the #include directive. It's a very simple-minded directive really. It just takes the contents of the included file and spits them out into the current file. Thus, if you change a header, you have to recompile a bunch of stuff, and the first compilation is always super-long.
    16. Re:Toss out C. by Anonymous Coward · · Score: 0


      declare all your functions before using them

      What's the big deal about this? If your tired of typing, you either need to learn to copy/paste, use an IDE that will generate code for you, or find a new industry.


      The deal is, more code = harder to maintain. Ok get an IDE that strips all this useless information. What do you have D.

      If you had 10000 lines of code or 5000 lines (D is so much smaller then C++), which would you prefer to read?

      I guess you like reading things over and over again?

      Why not go back to ASM. There's even more to read/write in that. This is just obvious. Pick up any decent programming paradim book and it will metion the three most important parts of a lanugage design:

      Reading
      Writing
      Orgthogonality

      So what your telling me is that you would prefer to type/copy paste something even though you don't have to? Or you want people to get yet another "device" (other then D) to make their programming nucences go away.

      So now we have to have an create an IDE to do these mundain tasks that arn't nessary anyway. Ok.

      Ever hear of "Make" and "Makefiles"? You don't need to keep recompiling things than havn't changed.

      Ever hear of DMC (C/C++ compiler). It's so fast most of the time you don't need a make file.

    17. Re:Toss out C. by newhoggy · · Score: 1
      Ever hear of "Make" and "Makefiles"? You don't need to keep recompiling things than havn't changed.

      I'm pretty sure every time I change my C++ files, it recompiles the STL headers I use even though they never change. *shudder*

      That's just a fact of C++ programming. Compiled template libraries are impractical as demonstrated by the failed export keyword so ALMOST EVERYTHING has to be in the header files. *faint*

      Something in C++ needs serious revision. But I have no idea what! *die*

    18. Re:Toss out C. by Anonymous Coward · · Score: 0

      I agree with the grandparent, declaring variables at the beginning does make for cleaner code

      I don't care about "clean" code, I care about correct code. And putting all variable declarations at the beginning is detrimental to code correctness. But, then, so is using C.

      And for those rare times when it makes a "huge performance difference", you can just add an extra level of curly braces! (Of course, I use C(not ++), so I HAVE to do this - so what do I know?)

      You can also program in assembly language (well, you kind of do), but most people don't want to.

  21. C! by zegebbers · · Score: 5, Funny

    We want C!
    with apologies to eminem...
    to the tune of 'without me'

    Two GUI classes go on the inside; on the inside, on the inside
    Two GUI classes go on the inside; on the inside, on the inside
    Guess who's back Back again C is back Tell a friend
    Guess who's back, guess who's back, guess who's back, guess who's back
    guess who's back, guess who's back, guess who's back..

    Sun's created a monster, cause nobody wants to code Java no more
    or basic, but something quicker
    Well if you want speed, this is what I'll give ya
    A language called C that won't let you do "is a"
    Some "has a" that makes me feel sicker
    than the bugs when I build patch that's critical
    using make to compile and be building
    with a language that allows object orientating

    Your var name's too long, now stop line breaking
    Cause I'm back, I'm a new var and instantiating
    I know that you got a job Bill and Steve
    but your company's trust problem's complicating

    So GCC won't follow ANSI or copy memory, so let me see
    They try to recompile with visual C But it feels so bloated, without C
    So, connect with SLIP, or create a RIP Fuck that, write a function, and shift some bits
    And get ready, and use a pattern like proxy MS just settled their lawsuits, expect a levy!

    Now this looks like a job for C So everybody, just code in C
    Cause we need a little, bit more speed Cause it runs so slowly, without C
    Now this looks like a job for C So everybody, just code in C
    Cause we need a little, bit more speed Cause it runs so slowly, without C

    Little Hallions, MS feelin litigious Embarrassed that users still listen to RMS
    They start feelin like ellen feiss 'til someone comes on the television and yells SWITCH!!!

    A visionary, beard's lookin' scary Could start a revolution, lives in a bear cave
    A rebel, although emacs ain't real fast and there's the fact that I only got one class
    And it's a disaster, such a castastrophe for you can see so damn much of my class; meant to use C.

    Well I'm back, i-j-k-x-y-z-out-ta-var-names Fix your damn indentifier tune your code and I'm gonna
    open it, under vim, maybe pico and variables, no such thing as a member
    I'm interesting, the best thing since assembly but not Polluting the namespace with inherits
    We're Testing, your functions please Feel the tension, soon as someone commits some C
    Here's my webpage, my code is free who'll pay the rent? What, You code with vi?

    Now this looks like a job for C So everybody, just code in C
    Cause we need a little, bit more speed Cause it runs so slowly, without C
    Now this looks like a job for C So everybody, just code in C
    Cause we need a little, bit more speed Cause it runs so slowly, without C

    An object in .NET, I go tit for tat with anybody who's setting this bit, that bit
    AT&T, you can get your ass kicked worse than those little C++ bastards

    And Ruby? just like a static property not even used with KDE and QT
    You're not like C, you're too slow, let go It's over, nobody'll code in OO!
    Now let's go, -9's the signal I'll be there with a whole list of XM and L
    I use SOAP, XPATH with XSL And you know perl's just like coding in symbols
    everybody only just codes C so this must mean, some com-pile-ing
    but it's just me i'm obfuscating And though I'm not the first king of controversy
    And i'm not the worst thing since assembly but I am the worst thing since 86 XFree
    do use BASIC and JSP and used it to get myself wealthy
    Here's a concept that works twenty million new coders emerge
    but no matter how many fish in the sea half of them can't even code C

    Now this looks like a job for C So everybody, just code in C
    Cause we need a little, bit more speed Cause it runs so slowly, without C
    Now this looks like a job for C So everybody, just code in C
    Cause we need a little, bit more speed Cause it runs so slowly, without C

    1. Re:C! by tsmithnj · · Score: 1

      You rock dude....

    2. Re:C! by EnglishTim · · Score: 0, Flamebait

      You fucking geek.

    3. Re:C! by Jugalator · · Score: 3, Funny

      by EnglishTim (9662)

      You fucking geek.


      You must be new h... No, wait...

      --
      Beware: In C++, your friends can see your privates!
    4. Re:C! by Vampyre_Dark · · Score: 1

      This is the first time I've ever been able to tell someone else they have a little too much fucking time one their hands.

    5. Re:C! by Anonymous Coward · · Score: 4, Funny

      I just HAVE to add this one:

      (sorry for the OoO, but else it wouldn't post cause I had to few chars per line)

      OoOoOoOoO WRITE IN C
      OoOoOoOoO
      OoOoOoOoO (sung to The Beatles "Let it Be")
      OoOoOoOoO
      OoOoOoOoO When I find my code in tons of trouble,
      OoOoOoOoO Friends and colleagues come to me,
      OoOoOoOoO Speaking words of wisdom:
      OoOoOoOoO "Write in C."
      OoOoOoOoO
      OoOoOoOoO As the deadline fast approaches,
      OoOoOoOoO And bugs are all that I can see,
      OoOoOoOoO Somewhere, someone whispers"
      OoOoOoOoO "Write in C."
      OoOoOoOoO
      OoOoOoOoO Write in C, write in C,
      OoOoOoOoO Write in C, write in C.
      OoOoOoOoO LISP is dead and buried,
      OoOoOoOoO Write in C.
      OoOoOoOoO
      OoOoOoOoO I used to write a lot of FORTRAN,
      OoOoOoOoO for science it worked flawlessly.
      OoOoOoOoO Try using it for graphics!
      OoOoOoOoO Write in C.
      OoOoOoOoO
      OoOoOoOoO If you've just spent nearly 30 hours
      OoOoOoOoO Debugging some assembly,
      OoOoOoOoO Soon you will be glad to
      OoOoOoOoO Write in C.
      OoOoOoOoO
      OoOoOoOoO Write in C, write in C,
      OoOoOoOoO Write In C, yeah, write in C.
      OoOoOoOoO Only wimps use BASIC.
      OoOoOoOoO Write in C.
      OoOoOoOoO
      OoOoOoOoO Write in C, write in C,
      OoOoOoOoO Write in C, oh, write in C.
      OoOoOoOoO Pascal won't quite cut it.
      OoOoOoOoO Write in C.
      OoOoOoOoO
      OoOoOoOoO Guitar Solo
      OoOoOoOoO
      OoOoOoOoO Write in C, write in C,
      OoOoOoOoO Write in C, yeah, write in C.
      OoOoOoOoO Don't even mention COBOL.
      OoOoOoOoO Write in C.
      OoOoOoOoO
      OoOoOoOoO And when the screen is fuzzy,
      OoOoOoOoO And the editor is bugging me.
      OoOoOoOoO I'm sick of ones and zeroes.
      OoOoOoOoO Write in C.
      OoOoOoOoO
      OoOoOoOoO A thousand people people swear that T.P.
      OoOoOoOoO Seven is the one for me.
      OoOoOoOoO I hate the word PROCEDURE,
      OoOoOoOoO Write in C.
      OoOoOoOoO
      OoOoOoOoO Write in C, write in C,
      OoOoOoOoO Write in C, yeah, write in C.
      OoOoOoOoO PL1 is 80's,
      OoOoOoOoO Write in C.
      OoOoOoOoO
      OoOoOoOoO Write in C, write in C,
      OoOoOoOoO Write in C, yeah, write in C.
      OoOoOoOoO The government loves ADA,
      OoOoOoOoO Write in C.

    6. Re:C! by zobier · · Score: 1

      http://www.mavetju.org/programming/songbook.php

      --
      Me lost me cookie at the disco.
  22. That's because 1.4 is the CURRENT version by the-matt-mobile · · Score: 3, Informative

    it's clear the author hasn't looked at Java since 1.4

    Well, since 1.5 is still in beta , I don't see how this is an invalid comparison.

    1. Re:That's because 1.4 is the CURRENT version by fforw · · Score: 3, Insightful
      it's clear the author hasn't looked at Java since 1.4
      Well, since 1.5 is still in beta , I don't see how this is an invalid comparison.
      .. because
      The specification and reference compiler are currently at version 0.82, and are expected to reach 1.0 within the year.
      So D will reach 1.0 around the release of Java 1.6 Beta.
      --
      while (!asleep()) sheep++
    2. Re:That's because 1.4 is the CURRENT version by Anonymous Coward · · Score: 0

      Is D out of beta?

  23. Re: Fads by dpbsmith · · Score: 5, Insightful

    Of course.

    There are fads in programming just as there are in clothing and management methodologies. And there are always people telling you to adopt the flavor of the month, I mean wave of the future if you don't want to become obsolete.

    And you can usually ignore them.

    I sat out PL/1, which, well, gee, it had BIG BLUE behind it (in a day when IBM's domination was far more complete than Microsoft's is now). And it doesn't seem to have done me much harm.

    True, you can score big by being the person who actually has the "two years experience in" (language-that's-only-existed-for-two-years) that the recruitment ads want, but if you go this route remember that it's easy to be knowledgeable in the latest language if you've just spent some unpaid years in college learning it. If you want to make a career out of always having the skill that's in demand, keep in mind that the only reason the skill is in demand is because it is rare--and you'll need to be quite clever at guessing the next fad, and dedicated about finding out how to educate yourself in it while keeping your day job.

  24. Re:the most interesting part of that table by molarmass192 · · Score: 1

    Whatever, first off they compared Java 1.4, not 1.5 so a lot of your C# Yes's are should be in the Java column. Also, some of the categories are just plain vague and the judgment call doesn't seem right. For example, "Independent or VM" and "Direct native code gen" are essentially the same and Java is listed as a No with no consideration ever given to GCJ which provides both of those for Java. Anyhow, use whatever damned language you want, I'm sticking to C, C++, and Java like the rest of the majority.

    --

    Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws-Plato
  25. Libraries by jetkust · · Score: 4, Insightful

    In the end, it may come down to having extensive library support weather this language gets any attention or not. Without having easy to use, easily availiable libraries for sound,graphics,networking etc..., along with support examples and help with the libraries, it may not be worth using the language at all. Sure you can import C/C++ based libraries, but this will all be unmanaged C/C++ code and not protected D code with all the bennifits of D.

    1. Re:Libraries by Tony+Hoyle · · Score: 3, Informative

      I'm not at all sure how the library compatibility will work in practice... all libraries come with header files, in C, which require a C compiler. Converting them will be nontrivial - especially since they change between versions. You'll end up making D wrapper functions which are no different to Java wrappers or Perl wrappers really.

  26. Nice to see a system language by wtrmute · · Score: 5, Insightful

    I've seen this language before, and I happen to think it's pretty cool. It's been almost ten years since we've seen a language that isn't compiled to bytecode and interpreted on a VM come out. If I need to write something that compiles to straight Linux ELF/Win32, I'm stuck with C (which I dearly love, but is 34 years old an not even OO) or C++ (g++ gives me terrible headaches, what with refusing to compile code with throw statements), and D is a pretty interesting bare-bones compiling language with very nice features.

    Really, kudos to Walter Bright for this little piece. It needn't become popular, if it stays good it's plenty more than enough.

    1. Re:Nice to see a system language by tiptone · · Score: 1


      [cough]

      ADA 95

      [/cough]

      Rather Object Oriented, right in all the places C is wrong, if it compiles you can almost be sure it's going to do what you thought it was.

      I know you weren't asking for suggestions but you got one anyway.

      --
      Please don't read my sig.
    2. Re:Nice to see a system language by RLiegh · · Score: 1

      It needn't become popular, it only needs to become free.

    3. Re:Nice to see a system language by juhaz · · Score: 2, Informative

      g++ gives me terrible headaches, what with refusing to compile code with throw statements

      What do you mean by that? G++ absolutely does support throw statements. How about an example of code snippet that doesn't work because of throw?

      Oh, and you're using 3.3, right? C++ has been moving so fast only recent compilers are any good...

    4. Re:Nice to see a system language by red+floyd · · Score: 1

      Ada95 cures most of the problems that Ada83 had.

      It's much more typesafe than C++, though Ada generics are less powerful than C++ templates, since they must be explicitly instantiated; i.e. the compiler won't find the best match.

      In other words, if you have a generic swap routine, you must declare each particular version

      e.g.

      procedure SWAP(x : in out integer, y: in out integer) is new GENERIC_SWAP(integer);


      However, given that Ada (83 and 95) was designed for mission critical "failure is not an option" apps, this tends to lead to less unexpected behavior (virtual functors anyone?).

      --
      The only reason we have the rights we have is that people just like us died to gain those rights. -- Cheerio Boy
    5. Re:Nice to see a system language by ckaminski · · Score: 1

      So what's changed in the past 5 years since I've used C++ extensively that I should be paying attention to?

    6. Re:Nice to see a system language by jareds · · Score: 2, Informative

      Both Objective Caml and SML (using, say MLton) can be compiled to ELF executables for the x86.

      Anyway, native-code compilation versus bytecode compilation isn't a property of a language, it's a property of an implementation. The GNU Compiler for Java exists.

      These were pretty arbitrary examples: there are plenty of options for native code executables besides C/C++.

      I don't mean to slight D, though!

    7. Re:Nice to see a system language by N1KO · · Score: 1

      Some guys started designing a library called boost meant to be used for the next version of ISO C++. They thought the language wasn't gigantically huge and complicated enough.

    8. Re:Nice to see a system language by wtrmute · · Score: 1

      3.2.something, I can't tell because I'm at work right now. Back when I last tried to compile a C++ project, it was the latest version available. I've been doing C since then and haven't had a reason to update.

      As for a code snippet, a simple throw "Exception thrown"; will compile OK, but give out a linker error to the flavor of "Unresolved symbol __throw" everywhere there are throw statements... but maybe I've just messed up on the configuration when I compiled the blasted thing. Who knows?

    9. Re:Nice to see a system language by juhaz · · Score: 1

      I think 3.2 should be fine.

      As for the error, sounds pretty weird. You might want to try manually enable throws with -fexceptions flag, though it should be done automatically for C++.

      Did this happen on both Linux and Win32 or just the latter?

  27. High Hopes by Randolpho · · Score: 4, Insightful

    Looks like the D website has gotten a facelift since the last time I checked in on the language. I've had high hopes for the concept. I've often felt that C++ needed syntactic a facelift away from C; I especially hate the preprocessor, and am glad D looks to get rid of it.

    The only thing about D that bothers me is the inclusion of the Garbage Collector and several other runtime components that occur in the background of your program. I'm not sure I really like that; it sounds a little *too* close to Java, if you get my drift. What I'd really love to see, and what I hope D inspires if not actually implements, is a language with the power of C/C++, but the easier syntax of Java.

    D *seems* to be the first step in that direction. I hope it goes further.

    --
    "Times have not become more violent. They have just become more televised."
    -Marilyn Manson
    1. Re:High Hopes by Psiren · · Score: 1

      What I'd really love to see, and what I hope D inspires if not actually implements, is a language with the power of C/C++, but the easier syntax of Java.

      I'm not sure I'd want that. A complaint I've heard several times from Java developers is that it's much too verbose. Needing to create set and get methods for every object etc. I'm not a Java developer so I can't comment on how much of a problem this is, but if it is true, I don't see what the appeal of it is.

    2. Re:High Hopes by pr0c · · Score: 1

      Flame me all you want but I always considered c# to be a language that uses the power of c/c++ and the ease of java minus the bullshit. The only two problems I see 1.) Anti MS lamers who can't look past the company being involved 2.) No native code, can't protect source, performance problems (not on the scale of java!). I would be so happy if I could compile my c# code into a real executable.. Hell I'd just be happy if it wasn't a 2 second time of investment to steal any code that I don't want open. (obfuscation is a joke).

    3. Re:High Hopes by Anonymous Coward · · Score: 0

      Never argue with an idiot... they will drag you down to their level and beat you with experience every time.

      Er, OK ...

    4. Re:High Hopes by jungd · · Score: 1
      I would be so happy if I could compile my c# code into a real executable

      The Ximian mono C# compiler (mcs) has an -aot option - ahead of time. It lets the x86 JIT output the native code back into an .exe.so. It is not completely stand-alone as the CLR required metadata at runtime for reflection and linking with other code (the IL .exe is still needed for the metadata).

      It might be possible to -aot the whole library and do away with the metadata if you don't use the System.Reflection APIs (?)

      --
      /..sig file not found - permission denied.
    5. Re:High Hopes by Randolpho · · Score: 1
      A complaint I've heard several times from Java developers is that it's much too verbose.
      No more or less verbose than C++. Unless you mean using the keyword extends rather than : to indicate inheritance (C# uses : as well, IIRC). I don't think that really makes that big a difference. I personally prefer the Java style, which is slightly more verbose, but that verbosity leads to more easily read code, IMO.
      Needing to create set and get methods for every object etc. I'm not a Java developer so I can't comment on how much of a problem this is, but if it is true, I don't see what the appeal of it is.
      Indeed, you are clearly not a Java coder, otherwise you would not have made the comment I hilited above. Creating get/set methods for every object has nothing to do with the Java language itself, and everything to do with OOA/OOD methodologies (which are often taught in conjunction with Java). Java does not require the use of get/set methods. Java can have public attributes, just like C++ can. Get/set methods are a means of encapsulation, used by programmers who prefer to use such a methodology, and nothing else.

      No, when I was talking about syntax, I was specifically talking about the logical grouping of classes within the class code block (rather than outside the class block using the scope operator to tell the compiler that it's a method not a function), the lack of needing a trailing semicolon... that sort of thing.
      --
      "Times have not become more violent. They have just become more televised."
      -Marilyn Manson
  28. "like Java and Perl" by jbellis · · Score: 0

    that's a pretty rediculous juxtaposition. perl is good language for one-offs and "duct tape;" Java is a systems language like. They really don't share the same problem domain; the one place they do intersect (web applications) is a place nobody uses C++, so they can't very well be supplanting it there. :)

    1. Re:"like Java and Perl" by CharAznable · · Score: 1

      It is a pretty ridiculous juxtaposition, but that's the point. People could be writing web apps, GUI apps, and any number of different things in C/C++, yet it has been supplanted in a lot of these applications by special purpose languages. It's been a while since I've done or seen someone doing web apps in C/C++. These days it's PHP/perl/JSP/ASP all the way.

      --
      The perfect sig is a lot like silence, only louder
  29. yay! by spungo · · Score: 0

    props to the homey... (whatever that means).

  30. Hmmm.... by shrykk · · Score: 4, Insightful

    C has a masssive codebase, and some real code wizards - we're talking people with 30 years experience. There are mature, free compilers avaiable.

    Walter Bright's D is free as in beer but not speech, and there's only the one compiler. Do we really need another language that's a bit like C++?

    --
    #define struct union /* Reduce memory usage */
    1. Re:Hmmm.... by Anonymous Coward · · Score: 2, Informative

      There is a (surprisingly complete) port by David Friedman to GCC-3.4. It is being used on Mac and Linux with impressive results.

      For more information see the D.gnu newsgroup on news.digitalmars.com

    2. Re:Hmmm.... by noselasd · · Score: 2, Insightful

      >another language that's a bit like C++?
      Yes. How many do we have that's like C++ ?
      None. We have Java,C#,Python and similar things.
      BUT, they're interpreted or JIT'ed languages.
      But really none(save perhaps objective-c) in the
      same league as C and C++.

  31. OSNews are coders now? by Gothmolly · · Score: 1, Offtopic

    Well, I guess with all the "I can't build GAIM from scratch because of lib.foo.so!" rants from Eugenia, then maybe they've become 31337 h4X0r5, but when was the last time that OSNews had anything decent or insightful? I'm surprised that there's been no bitching about 'theming' this new language.

    --
    I want to delete my account but Slashdot doesn't allow it.
  32. Success is Elusive by ChaoticCoyote · · Score: 5, Insightful

    D is certainly a very interesting language;

    However, there are many interesting languages. Over the years, I've explored Prolog, Modula-2/3, Oberon, Haskell, Ocaml, and others. All of those embody some very interesting concepts; in some cases. they may be "better" than mainstream languages.

    But the fact remains that no one has ever paid me (or anyone else I know) to write code in Ocaml, Haskel, Oberon, Prolog, or D. For the most part, it is C, C++, and Java that feed my family; upon occasion, clients need Python and Fortran 95. I'd love to be paid for a project in D or Ocaml; I'm not going to bet the farm on that happening.

    I wish the world of languages (both human and computer) was more diverse -- but reality suggests a hard road to popularity for original concepts like D. I respect and appreciate Walter Bright's abilities; his Zortech compiler paved the way for C++, and provided excellent optimization. I wish him luck in promoting his vision.

    1. Re:Success is Elusive by MyFourthAccount · · Score: 1

      I'd love to be paid for a project in D or Ocaml; I'm not going to bet the farm on that happening.

      So true.

      On the one hand it's obvious that management doesn't want to take the risk when there's such a large pool of C(++) programmers out there, but it certainly would be nice to have some productivity enhancements that could fit the gap between C/C++ and C#/Java.

      I think one of the easiest way to overcome this is to create a language that can cleanly be translated to C/C++.

      In other words if there was a compiler that translated D to C++ (with support code written in clean ANSI C++), then it may be a lot easier to convince management to take the risk.

      So long as the generated C++ code is clean, there's always the option to revert back to C++.

      There's another reason to take this approach. Some people will insist on using a certain tool-chain. They don't want to use an optimizing compiler from a relatively small/unknown company (I write software for aircraft sometimes, and I know I'm very picky about my tool-chain). Anyone that has followed the state of the optimizers of several of the well known C(++) compilers will know what I'm talking about.

      So having a relatively simple translator that is just designed to do the job correct and leave the optimizations to the C++ compiler, that's a lot easier to swallow.

    2. Re:Success is Elusive by pHDNgell · · Score: 1

      But the fact remains that no one has ever paid me (or anyone else I know) to write code in Ocaml, Haskel, Oberon, Prolog, or D.

      I'm paid to bring a concept to life, not write code in a particular langauge. I have written code at my current company in Java, ocaml, python, C, sh, scheme, and even a bit of perl (that was maintenence, though). I had written some Eiffel, too, but it didn't get deployed because it didn't seem to run nearly as fast as the Eiffel equivalent.

      I use the tool I feel will allow me to fulfill my requirements most succesfully and quickly, and then I move on. If I make a case for writing (at least a portion of) our network management system in erlang, it will happen, and it will be successful.

      --
      -- The world is watching America, and America is watching TV.
    3. Re:Success is Elusive by Anonymous Coward · · Score: 0

      You're paid to bring a concept to life AND to ensure that it can be understood and maintained by those that come after you.

    4. Re:Success is Elusive by WalterBright · · Score: 1
      While the odds against D have been daunting, it is well on the exponential growth/adoption curve. The D newsgroup (news.digitalmars.com) has over 25,000 postings in it, and the downloads of the language increase substantially month by month. There's now a gnu version of the compiler, and a growing list of third party libraries and projects for it (see these, for example).

      The real question is, when are you going to write a book on D? :-)

    5. Re:Success is Elusive by typhatix- · · Score: 1

      If you can't pick up the basics of a programming language in a week, get out of this industry. If you choose a programming language so complex no one can pick up the basics in a week, get out of this industry.

      If people heeded either of these tips, C++ would be a lot less popular.

    6. Re:Success is Elusive by Anonymous Coward · · Score: 0

      I can pick up the basics of most languages within a day or two, thank you very much. That's not the point. If you're coding something that's a throw-away, one-time tool, fine. BUT... if you're coding something for the future, and you use a language or tool that's not standard for the company or industry, then you're just causing more headache. I'd fire your ass for using OCAML or Eiffel without my prior authorization.

    7. Re:Success is Elusive by sonamchauhan · · Score: 1

      "I can pick up the basics of most languages within a day or two, thank you very much. That's not the point. If you're coding something that's a throw-away, one-time tool, fine. BUT... if you're coding something for the future, and you use a language or tool that's not standard for the company or industry, then you're just causing more headache."

      Good point.

  33. Re:the most interesting part of that table by maxwell+demon · · Score: 1

    Then what about Java on BSD?

    --
    The Tao of math: The numbers you can count are not the real numbers.
  34. D'oh! by SkimTony · · Score: 2, Funny

    I believe you're mistaken. D stands for "Duke Nukem Forever."

    The delays in release of the game are simply a result of having to wait for a new programming language in which to write the software.

  35. Design by Contract by NewWaveNet · · Score: 1

    I was oddly confused when I read that un-sourced term in the quickie part of the story...so, from this page:

    Contracts are a breakthrough technique to reduce the programming effort for large projects. Contracts are the concept of preconditions, postconditions, errors, and invariants. Digital Mars introduces the first C and C++ compiler to support contracts. Building contract support into the language makes for:

    1. A consistent look and feel for the contracts
    2. Tool support
    3. It's possible the compiler can generate better code using information gathered from the contracts
    4. Easier management and enforcement of contracts
    5. Handling of contract inheritance


    The idea of a contract is simple - it's just an expression that must evaluate to true. If it does not, the contract is broken, and by definition, the program has a bug in it. Contracts form part of the specification for a program, moving it from the documentation to the code itself. And as every programmer knows, documentation tends to be incomplete, out of date, wrong, or non-existent. Moving the contracts into the code makes them verifiable against the program.

    1. Re:Design by Contract by Anonymous Coward · · Score: 1, Interesting

      And this differs from assertions how, exactly? (Honest question - looks very much the same to me...)

    2. Re:Design by Contract by Anonymous Coward · · Score: 0
      The idea of a contract is simple - it's just an expression that must evaluate to true.

      so why don't they just call it an assert statement so us chickens can understand what they're talking about, too?

    3. Re:Design by Contract by Dachannien · · Score: 1

      In the event your function has multiple exit points, it's a lot easier to write one post block than a whole bunch of asserts strewn throughout your code.

      That said, failure in those blocks should probably result in thrown exceptions rather than asserting.

    4. Re:Design by Contract by Elbows · · Score: 1

      DbC is more powerful than asserts -- in addition to pre/post blocks (that always get called no matter which return path your code takes), you can write class invariants that are checked after every method of a class.

      Plus, the pre/post conditions and invariants can be automatically extracted to generate documentation.

      At least, that's how it works in Eiffel, which basically pioneered DbC. I don't know the details of D's implementation.

    5. Re:Design by Contract by stripes · · Score: 1
      And this differs from assertions how, exactly?

      Some syntactic sugar to allow you to assert things on multiple exit paths without putting an assert on each bit. The compiler also knows that nothing can get past an assert without satisfying the assert, so it can use that information to optimize. (and that can be done even when you do a "production build, don't check asserts" which you can't do in C/C++)

      Also the focus is a little different, in a DbC language you are expected to use them all over the place. In C/C++ it is frequently thought of as a "matter of style", or even outlawed because "it makes stuff crash".

  36. Wishing for this yesterday by miyako · · Score: 3, Interesting

    Just yesterday I was thinking about how usefull a language like this would be. Java doesn't run too slowly anymore for most applications, but at times it is just impossible to justify it's slowness compared to a natively compiled language. GCJ seems like a good idea in theory, but doesn't seem to really be going anywhere.
    Being able to use pointers if need be is also something really nice about this language that I have found that i really long for in Java at times (not so often to actually use, but oh how much easier it would be to explain the way some things work if pointer wasn't a dirty word in java).
    I have not really looked at C# much, but it seems to be freed of many of the complaints about Java (lack of pointers for example), but still has the problem of being a bytecode compiled language running in a VM, and adds the problem of being owned by the company that everyone loves to hate (or at least not trust). AFAIK C# also is not C compatible.
    I think these facts leave at least a niche for D, and if it's well done it could soon become one of the DeFacto languages of the future. It seems like development has been going on for quite a while on this, I'm honestly suprised that i've never run across it before, since I have been, mostly out of curiosity, looking for just this. I'm not sure how it will pan out, but I am definitly going to give this new language a shot.

    --
    Famous Last Words: "hmm...wikipedia says it's edible"
    1. Re:Wishing for this yesterday by metamatic · · Score: 1

      Try Objective-C. 100% native code, total C compatibility, and you can freely mix manual (C-style) memory allocation, reference-counting semi-automatic memory allocation, and full garbage collection (with add-on libraries). Plus it only takes a weekend to learn if you already know C.

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
  37. actually, the more important reason for exceptions by jbellis · · Score: 5, Interesting

    is that when you get an error that is properly handled 3 or 5 or 10 levels out from where the error happens, you DON'T want to have to check for that error in all the intervening calls. Your code would be messy as hell, and what happens more often, as you can see in a LOT of C code out there, is the coder pretends the error just won't happen.

    Exceptions let you throw the error where it happens and catch it where it makes the most sense, however far down the stack that may be.

  38. And enables you to write by EachLennyAPenny · · Score: 1

    funny words like ABACADABRA only using names of programming languages.

  39. At least S! by samrichards · · Score: 1

    In fact, if you follow the "What is R?" link from the R-projects main page, you'll see that:

    It is a GNU project which is similar to the S language and environment ...

    And I wouldn't bet against there being a link to a "T" language on the S project's homepage or something.

    What next? AB language? Eventually we'll get to COBOL all over again! Oh No!

    1. Re:At least S! by Anonymous Coward · · Score: 0

      I seem to recall a lisp variant called "T"... anyone know of a language called "U" ?

  40. D as Delphi? by Tuqui · · Score: 3, Funny

    It will be interesting to see how it compares to Delphi too.

    1. Re:D as Delphi? by certsoft · · Score: 2, Insightful
      It will be interesting to see how it compares to Delphi too.

      Although this was moderated as "Funny", I think it's a serious question. It's common, when making what are essentially marketing comparisons, to leave out competitors that would make your target "less amazing".

  41. All the C++ programmers are laughing at you... by Chemisor · · Score: 3, Funny

    Every once in a while people try to improve on C++. Usually it is those wet-behind-the-ears kids straight out of college who think that because C++ is too hard for them, it is a bad language. But real programmers just shrug and keep on coding in C++. Let the kids have their fun; they'll come around eventually when they want to write some real code. Maybe someday they'll discover that garbage collection is not necessary when you know who owns your memory and encapsulate allocation in logical places, like STL containers. They'll discover that C++ already has overridable operators, full (well, all that matters, anyhow) C compatibility, native compilation (VMs are for script kiddies), inline assembler, and in-built support for unit testing (called a debugger). And as for "Design by Contract", good luck getting any contracts in your new D.

    1. Re:All the C++ programmers are laughing at you... by Anonymous Coward · · Score: 1, Interesting
      [very naive C++ fanboy comment elided]

      Yeah, "real" programmers keep on coding in C++...they press on despite:

      ...a high incidence of memory management related problems, which are often very hard to find

      ...common security issues, often involving buffer overflows

      ...compiler incompatibilities, including frequent lack of proper template support, exception handling, namespaces and so on

      ...obscure and often terribly non-intuitive syntax

      ...overly complex and redundant idioms necessary to work around language shortcomings

      or they just switch to a more productive language...like the majority of the software industry is doing.

      D looks interesting, and may well be a good alternative to Java and C# if good compilers become available. The DBC support looks promising. In the meantime, gcj is doing pretty well with ahead-of-time Java compilation.

    2. Re:All the C++ programmers are laughing at you... by rblum · · Score: 5, Interesting

      Yep - totally agree. But the guy behind D is not a wet-behind-the-ears college kid. He wrote one of the first C++ compilers for Zortech.

      So if somebody with those credentials thinks there are things we could do better, maybe we should at least take the time to listen to him....

    3. Re:All the C++ programmers are laughing at you... by slamb · · Score: 1
      Yeah, "real" programmers keep on coding in C++...they press on despite:

      ...a high incidence of memory management related problems, which are often very hard to find

      That's true of older C++ code. But now there are very good smart pointers classes. I just don't have these sorts of problems anymore. At most, I get an unexpected NULL, which immediately causes a SIGSEGV - not so different from Java's java.lang.NullPointerException.

      ...common security issues, often involving buffer overflows

      You can screw this up in C++, so languages like Java are arguably more secure in this fashion. But C++ is not C. It's easier to do things safely than to screw them up.

      ...compiler incompatibilities, including frequent lack of proper template support, exception handling, namespaces and so on

      True, but getting better.

      ...obscure and often terribly non-intuitive syntax

      True.

      ...overly complex and redundant idioms necessary to work around language shortcomings

      True.

    4. Re:All the C++ programmers are laughing at you... by neurojab · · Score: 1

      >in-built support for unit testing (called a debugger)

      Good Lord. Unit testing and debugging are the same thing to you? Yet you have the gaul to call someone else a "script kiddie". Let's hope I don't use any of your software. In the meantime please have a look at the xUnit suite. You might learn something quite useful today.

    5. Re:All the C++ programmers are laughing at you... by LWATCDR · · Score: 1

      I will say that that the chart was a little one sided and seemed to pretend that the STL does not exist.

      How ever the Comment that VMs are for script kiddies, I would not call Wirth or Kunth "script kiddies". If you do not know who they are I suggest you look them up. Many of C++'s problems have been fixed with boost and the STL not to mention that there is a garbage collection lib.

      D is interesting how about a GNU D compiler

      --
      See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
    6. Re:All the C++ programmers are laughing at you... by primus_sucks · · Score: 1

      I prefer assembler. Who want's some dumb ass compiler slowing your program down by 10% or deciding which bits go into which registers. High level languages are for whimps.

    7. Re:All the C++ programmers are laughing at you... by Anonymous Coward · · Score: 0

      CPUs are for script kiddies. Real men use slide rules!

    8. Re:All the C++ programmers are laughing at you... by Chemisor · · Score: 1

      > Unit testing and debugging are the same thing to you?

      Not exactly. I think unit testing (as in having a bunch of little programs that go through each code path) is useful to some degree, but is not a solution to all your problems. If your interfaces are clean and you know what your objects are doing, unit testing is probably superfluous. Mostly it means you spend more time writing tests than fixing your code, and the latter is what I would rather be doing. You might object that there are bugs that I could miss this way, and you are correct; however it is unlikely. Most of my code is very simple in implementation; complexity arises from combination of simple components in logical fashion, so my bugs are usually of the kind that tells me there is something wrong with my design. This is not something you can write a test for, but it is usually obvious when something does not fit.

    9. Re:All the C++ programmers are laughing at you... by Anonymous Coward · · Score: 0

      > D is interesting how about a GNU D compiler

      It's already pretty far along. A previous answer pointed to:
      http://home.earthlink.net/~dvdfrdmn/d

      Also check out the D and D.gnu newsgroups on news.digitalmars.com

    10. Re:All the C++ programmers are laughing at you... by psetzer · · Score: 0

      Whyzit that partisans for most every other language will admit that there are some things that they weren't meant for, like Cobol and graphics programming. However, when it comes to C or C++, it's reasonable to turn everything into a systems project strapped onto another project, and anybody who has any different needs is completely incompetent? I like data structures. I really hate dealing with memory allocation. If my project doesn't really need that extra 10% speed boost, why should I bother dealing with making sure that there are no memory leaks? Yes, I know that there's a feeling of craftsmanship, and I want my code to be bug-free. Knowing that it won't blow up on me in that way at least is worth some cycles. If you're worried about the garbage collector being called at some inopportune moment, try running it simultaneously with an IO block through multithreading.

      --
      "Anyone who attempts to generate random numbers by deterministic means is living in a state of sin." -- John von Neumann
  42. Obsession with C-like syntax by Bander · · Score: 5, Insightful

    I don't understand why these people keep designing C-like languages that are nothing like C. By the time they are done, the resulting language has so many more features than C, the surface similarity is more of a boondogle than a benefit. While not perfect, C syntax is great for what C is, "human-readable assembly language". When you try to extend it to object oriented systems, the end result is a confusing mess.

    There are far better syntax models for an object-oriented programming language than C. I wish people who feel a need to create new languages were willing to base their efforts on a framework more suited to their goals.

    Bander (in curmudgeon mode)

    1. Re:Obsession with C-like syntax by CaptnMArk · · Score: 1

      like what? begin end ? or ...: pass ?

    2. Re:Obsession with C-like syntax by Bander · · Score: 1

      like what?

      I'm fond of Python, which sports a very clean, readable syntax without giving up flexibility or power. Python is good if you don't want to give up a traditional class/method, loop/imperative style of programming.

      There's also Smalltalk, which requires getting one's head around a different model of program design, but can yield very elegant and effective solutions. Squeak is a good place to start for those curious about Smalltalk.

      Those are just a couple of suggestions. There are lots more out there. And of course, if you're happy with Java or C#, well, who am I to stand in the way of your joy?

      Bander

    3. Re:Obsession with C-like syntax by Dun+Malg · · Score: 1
      like what? begin end ?

      I'm helping a friend convert a huge app written in Pascal (shudder) to C++. I want to know whose great idea it was to use KEYWORDS as block delimiters. Was it Wirth? Whoever it was they deserve a kick in the shin from those of use stuck trying to decipher ancient, unreadable crap written in [Pascal|Ada|etc].

      --
      If a job's not worth doing, it's not worth doing right.
    4. Re:Obsession with C-like syntax by red+floyd · · Score: 1

      What's the diff? 'begin' is a keyword in Pascal. '{' is a "keyword" in C or C++. It's all lexical scanning. By the time the parser gets it, there's no longer a string, but a single token indicating "BLOCKBEGIN".

      --
      The only reason we have the rights we have is that people just like us died to gain those rights. -- Cheerio Boy
    5. Re:Obsession with C-like syntax by skeptikos · · Score: 2, Insightful

      I think it's kind of a marketing issue. When a new language is proposed and does not look like C but more like Ada/Pascal/Modula etc many programmers will just say "It is so verbose, there is no ++ operator, and it shoud use braces, they save LOTS of typing!". Who cares if the programs are more readable. I happen to be interested in programming language design, and I have asked some programmers "What would an ideal language be like". They all answer "Oh, it should be like X, but with feature Y", where X is their favorite language and Y is their favorite (usually superficial) missing feature of X. Stangely, nobody answers "It should use garbage collection, it should have easy to remember operator precedeces, it should disallow jumping into data, it should have optional array bound checking" and so on. People just look at superficial properties of the language, mostly the lexical part. They don't even get to the context free part, and forget about semantics. If it looks like C/C+/Java (which they know) it must be like C/C++/Java (and they feel confortable)

    6. Re:Obsession with C-like syntax by Dun+Malg · · Score: 1
      What's the diff? 'begin' is a keyword in Pascal. '{' is a "keyword" in C or C++. It's all lexical scanning. By the time the parser gets it, there's no longer a string, but a single token indicating "BLOCKBEGIN".

      True, '{' is a keyword. I should have said keyWORD. I'm just throwing a tantrum, anyway. We've been trying to reimplement this crawling horror for months and, really, the readability issue is the fault of the original programmer not sticking to one style of indenting, even across a single unit. I'm just not used to "seeing" blocks not bracketed by nearly empty lines, so it makes it even harder. I'd throw an even bigger fit if I had to read code with original K&R style blocks.

      --
      If a job's not worth doing, it's not worth doing right.
    7. Re:Obsession with C-like syntax by red+floyd · · Score: 1

      Write a quick and dirty keyword translater in FLEX and then run the results though gindent (or your favorite beautifier).

      --
      The only reason we have the rights we have is that people just like us died to gain those rights. -- Cheerio Boy
    8. Re:Obsession with C-like syntax by Dun+Malg · · Score: 1
      Write a quick and dirty keyword translater in FLEX and then run the results though gindent (or your favorite beautifier).

      That's a good idea. I'm still trying to get the fellow I'm helping (the original implementor's son) to let me have a copy of the source to take home. He's a friend of mine, but he's crazy paranoid about his dad finding out he's having trouble with it. I told him I'd give him a hand with it for cheap. No good deed goes unpunished, eh?

      --
      If a job's not worth doing, it's not worth doing right.
    9. Re:Obsession with C-like syntax by CaptnMArk · · Score: 1

      I'd actually like the python syntax if "pass" was mandatory, like this:

      if a >= 0:
      print "ok"
      pass

      This would allow editors (emacs mostly does a good job already) to provide automatic code indentation (for me a 100% must have feature).

  43. Other language out there by Bluelive · · Score: 1, Redundant

    http://pluk.sf.net/ is also a programming language that has similair syntax, open source, BSD licensed, and still in development, so you can still insert your killer feature.

  44. this is strikingly similiar to Pike by Anonymous Coward · · Score: 2, Funny
    from Pike website:

    Pike is a dynamic programming language with a syntax similar to Java and C. It is simple to learn, does not require long compilation passes and has powerful built-in data types allowing simple and really fast data manipulation.


    Syntatically, D is almost identitical to Pike, like the foreach and the range operator "..". Pike is also loosely object oriented, and has a rich set of libraries just like Python, Perl or even Java.

    I'm not sure if the Author has borrowed ideas from Pike, but it is is really a great language that has been around for 10+ years, tested in real world applications.

  45. Re:the most interesting part of that table by ThosLives · · Score: 2, Interesting
    Actually, the most interesting thing I saw is that D defines a type 'ireal' which is an imaginary number. They also have 'creal' which is a complex number. What's funny to me is that, by definition, imaginary and complex numbers are not real at all.

    I found this immensely amusing...and yes, I know that's sad.

    --
    "There are a dozen opinions on a matter until you know the truth. Then there is only one." - CS Lewis (paraprhase)
  46. How about Eiffel by charnov · · Score: 2, Interesting

    I'll admit I suck as a programmer, but Eiffel was the first language that actually made sense to me and from what I have been told (I have to trust others on this one), it generates extremely clean and safe programs.

    --
    [RIAA] says its concern is artists. That's true, in just the sense that a cattle rancher is concerned about its cattle.
    1. Re:How about Eiffel by shiftless · · Score: 1

      Agreed. It has a few shortcomings, but nothing that couldn't be fixed, especially if we could get more developers. The huge number of advantages far outweigh the downsides for most applications IMO.

  47. A feature every language should have by bangular · · Score: 3, Interesting

    Speaking of perl...
    I really wish lanugages would start implementing the ~ operator from perl (as with $myvar =~ /expression/). From what I understand Ruby also has it. I'm tired of having to deal with pcre's little caveats (as implemented in php, python, java, c, c++ etc.). Such as having to compile the expressions beforehand. Or having to play the backslash game \\\\n to get a newline. There's nothing nicer than being able to have a regular expression that does exactly what I want on one line with minimal code. When programming in perl I tend to use the =~ operater almost as much as the == operator!

    1. Re:A feature every language should have by flannelboy · · Score: 1

      Actually, C# has this feature - you can use triple quotes. As in:
      String foo = """quote your \n stuff here""";

    2. Re:A feature every language should have by tgv · · Score: 1

      It's quite easy to implement in C++. You can define something like bool operator==(const char*, const RegExp&). You would only have to define a class RegExp that can be statically constructed, so

      class RegExp { RegExp(const char* expr) { ... } }

      Then you add your regular expressions as global variables (or static class variables):

      static RegExp number("[0-9]+");

      and you can write

      if ("144" == number) { ... }

      If that isn't simple enough...

  48. Managed code is not all bad! by gregduffy · · Score: 1

    The article speaks of managed code as if it is a Bad Thing. Sure, systems level code is sometimes necessary, but for normal application code and especially trusted computing initiatives, a VM is a must.

    1. Re:Managed code is not all bad! by reapermane · · Score: 1

      If someone wants to write a D compiler that supports mangage code, by all means. D is powerful enough for my needs. Also you can actually write your own VM layer in D if you so wish.

  49. D does not have dynamic classloader by Guardian+of+Terra · · Score: 5, Insightful

    This is a very very big problem. Plugin problems, binary compatibility problems, DSO problems, vtable format problems, and all other things we hate in C++ and that absent in java/c++

    1. Re:D does not have dynamic classloader by eluusive · · Score: 1

      Not yet, but it will by D 1.0.

  50. P, not D. by IGnatius+T+Foobar · · Score: 2, Interesting

    Wow. The "D" developers don't know their C history if they chose that name. There was a language called BCPL, which begat a subset called B (the first letter of the name), and then its successor, C. Therefore the next successor would be called P, not D.

    Buncha wetbacks. :)

    --
    Tired of FB/Google censorship? Visit UNCENSORED!
    1. Re:P, not D. by tpv · · Score: 4, Interesting
      Supposedly B was not actually named after BCPL

      See the Wikipedia

      --
      Read more of this story at Slashdot.Read more of this story at Slashdot.Read more of this story at Slashdot.
    2. Re:P, not D. by zhenlin · · Score: 1

      The creators of C/Plan 9 designed a new language, and decided to call it 'Aleph', the first letter of most Semitic alphabets. So... we don't know whether they intended to use the standard alphabet or 'B, C, P, L' C++ sidestepped this problem.

      Maybe they should have called it C+=2.

  51. Ooops by EnglishTim · · Score: 3, Funny

    Meant to post that anonymously...

    1. Re:Ooops by JusTyler · · Score: 1

      Well that was a good way of getting back the lost mod points wasn't it! ;-)

  52. I refuse to support D by maunleon · · Score: 2, Redundant

    Cuz it makes it hard to google for "D".

    1. Re:I refuse to support D by XBL · · Score: 2, Insightful

      Actually this is a good point. If I want Java help, I can search for "Java SOMETHING" and the search results will likely be good. "D SOMETHING" will not work.

    2. Re:I refuse to support D by black+mariah · · Score: 1

      Have you tried it, or are you assuming it won't? I had no problem finding information on D the other day when I was reading up on it.

      --
      'Standards' in computing only impress those who are impressed by things like 'standards'.
    3. Re:I refuse to support D by maunleon · · Score: 1

      Well, I get quotes for a company with stock symbol D, then the top links are:

      D-Link Systems, Inc.
      D-Lib Magazine
      Physical Review D, Journal

    4. Re:I refuse to support D by UserGoogol · · Score: 1

      You'd be suprised. D programming brings up what you want, as does D tutorial. Although more specific stuff like D quicksort doesn't work.

      --
      "Never attribute to malice that which can be adequately explained by stupidity." -- Hanlon's Razor
  53. i loved D!! by dioscaido · · Score: 1, Funny

    .. when it was called C#!

    1. Re:i loved D!! by Anonymous Coward · · Score: 0

      What, are you tone deaf or something?

      C# is a whole semitone lower than D. Cx (double sharp) is D though. C# is certainly D flat.

  54. Full C compatibility sucks by squarooticus · · Score: 5, Insightful

    Being a long-time C++ software engineer (10+ years), the biggest thing that irritates me about C++ is backwards compatibility with C. I would love to have to explicitly cast everything, including between signed and unsigned scalars: in such a case, it is perfectly clear to the programmer when he is performing a type-mismatched comparison or assignment, something that has bitten me often in the past.

    In sum: C++'s biggest problem is its C legacy. Tear it away, add real type-safety, and you have a language much more powerful and safer than Java.

    --
    [ home ]
    1. Re:Full C compatibility sucks by the_Speed_Bump · · Score: 1

      D has full *link* compatibility with C. Not source. (if it was source-compatible, it would be C++)

      FYI, D *does* require you to cast between signed and unsigned integers. :)

      --
      "Break out the gin, and the small violin, I'm a raging success as a failure." --Firewater
    2. Re:Full C compatibility sucks by Anonymous Coward · · Score: 0

      sheesh...switch to Pascal

    3. Re:Full C compatibility sucks by pHDNgell · · Score: 1

      C++'s biggest problem is its C legacy.

      Many people have many different opinions on what C++'s biggest problem is. Not to say that that isn't a valid one.

      --
      -- The world is watching America, and America is watching TV.
    4. Re:Full C compatibility sucks by Anonymous Coward · · Score: 0
      Being a long-time C++ software engineer (10+ years)

      You should have said 10++ years and it would have sounded so much more credible. :-p

    5. Re:Full C compatibility sucks by Old+Wolf · · Score: 1

      Must compilers have switches to warn about signed-unsigned comparisons, and to warn about
      implicit casts to types with a smaller range.

  55. The preprocessor is archaic? by Viol8 · · Score: 1

    Well if it is then someone has obviously designed a fully functional compiled language that operates EXACTLY the same way on ALL
    architectures even though it goes down to bit level operations. Wow , I'm impressed given that no one else has managed to do that yet. Tell me , how for example does it deal
    with big/little endian issues at compilation?

    1. Re:The preprocessor is archaic? by bradkittenbrink · · Score: 2, Informative

      I didn't find how it deals with endianness specifically, but the idea is that D replaces a text-only preprocessor with actual sybolic features of the language. They definitely have support for conditional compilation and inline assembly code so I'm sure you could do whatever you need to handle endianness without a text-based preprocessor. The preprocessor itself isn't necessarily archaic, it's just unneccesary if your language isn't archaic.

    2. Re:The preprocessor is archaic? by greenrd · · Score: 1
      Well if it is then someone has obviously designed a fully functional compiled language that operates EXACTLY the same way on ALL architectures even though it goes down to bit level operations. Wow , I'm impressed given that no one else has managed to do that yet.

      Java does that, ignorant fool.

      What's that? Java's not compiled, you say?

      What do you call Hotspot then?

    3. Re:The preprocessor is archaic? by Anonymous Coward · · Score: 0
      bool version(LittleEndian)

      bool version(BigEndian)

      Hope that helps.

    4. Re:The preprocessor is archaic? by ckaminski · · Score: 1

      Please, name me a compiler that deals with big/little endian issues at compilation. I'm genuinely curious. I know a LOT of CORBA guys who'd be interested in an optimization like this. :-)

    5. Re:The preprocessor is archaic? by Viol8 · · Score: 1

      I said compiled language , not compiler per se hence the point about the preprocessor. Do try and keep up.

    6. Re:The preprocessor is archaic? by Viol8 · · Score: 0, Flamebait

      Java doesn't deal with physical memory mapping you idiot , its a higher level language so endian issues don't come into it. I should have qualified
      my statement with "low level" compiled languages. BASIC can be compiled but you don't get endian issues there either.

  56. Re:Next big thing? by 12357bd · · Score: 1

    As a fellow said :EOP, That's what we do, Error Oriented Programming, all day long!.

    You know, to decide to program is always the first error.. and so on.. (Murphy).

    What's in a sig?

    --
    What's in a sig?
  57. Re:actually, the more important reason for excepti by arkanes · · Score: 4, Informative

    Checking return values is a horrible use for exceptions. Exceptions are for critical but recoverable errors. "Normal" error conditions shouldn't throw exceptions, not least of which because it makes the code so much nastier and twisting to deal with it. Exceptions are great and allow you to do a type of error handling that would be impossible without them, but I think that some C++ (and especially Java) people get far to enamored of them.

  58. Re:the most interesting part of that table by Trejkaz · · Score: 3, Informative

    Troll away, maybe people will start paying attention when the dozens of useful Java libraries are available from C#. *shrug*

    What I really need right now though is a nice, clean looking language with access to well-thought-out libraries for image loading/saving and virtual filesystem access. I can't find any of this stuff in a portable form other than on Java, unfortunately. :-(

    --
    Karma: It's all a bunch of tree-huggin' hippy crap!
  59. Re:actually, the more important reason for excepti by 12357bd · · Score: 1

    Oh! sure, nice, but then the problem is with resources allocated on those 3, 5 or 10 'skipped' levels during exception handling.

    No easy way out.

    What's in a sig?

    --
    What's in a sig?
  60. I thought from the headline... by Anonymous Coward · · Score: 1, Funny

    I thought from the headline that the new title was D!; D bang. Ahhahaahhahahaaa.. what a cool name!

  61. Re:Hardware problem? by Bastian · · Score: 1

    For as long as there's a need to be able write anything in assembler or a decent system programming language, there will be a need for some modicum of protection in hardware.

    Though I do gotta say, if you ever write a device driver in Java I'd love to see it.

  62. Re:actually, the more important reason for excepti by Anonymous Coward · · Score: 0

    In C++, the destructors for those objects run to reclaim those resources.

    In garbage-collected languages, the garbage collector reclaims memory automatically. If you've allocated other kinds of resources, such as file handles, you need a finally block to clean these up. C# makes this easier: the compiler automatically generates the appropriate cleanup code if you allocate resources in a "using" block.

    On balance, the languages that have exception handling mechanisms, such as C++, Java and C#, make life easier for programmers to prevent leaks in the face of errors, not harder.

  63. D WON'T compile C code by 21chrisp · · Score: 5, Informative

    It's seems that a lot of people are complaining about something that was seriously mis-reported. D CAN'T COMPILE C CODE!! (Sorry for shouting.. but I'm hoping to get peoples' attention). D can link to C binary code.. wow.. what a concept.. almost every programming language can do this. It's almost a requirement for any new language. Without it you would start with 0 code base, and no one will use it. The below text is taken directly from the article. Notice 'Binary Compatibility' and 'Link Compatible.'

    Binary C Compatibility:
    D programs can import and link against C code and libraries, providing D with free access to a huge amount of pre-written code. Note, however, that D is not link-compatible with C++, so pure C wrappers are required to access C++ code in D.


    Personally, I've been praying for years for a language like this to get adopted. Why is it that I can only use full object oriented programming for web/network applications?! Sure.. I know you can do more than this with Java or C#, but is it really practical?? Usually it's just a massive drain on resources. If you need high performance, then you can't do better than C++. Unfortunately, C++ is a transitional language (just look at it's name..). A pure object oriented, fully compilable language that has no VM is desperately needed. I can't believe it's 2004, and such a thing still hasn't been adopted. I hope D (or something like it catches on.. As much as I loved it when it first came out, I'm sick of wrestling with C++ code.

    1. Re:D WON'T compile C code by Bluelive · · Score: 1

      Maybe take a look at Pluk ( http://pluk.sf.net )

  64. D converts code to C by noselasd · · Score: 2, Interesting

    Just fyi, D is really a frontend. It generates C code, which is then
    compiled with your ordininary gcc. Nice imho so you get great speed,
    and don't have to write a compiler again ;)

    1. Re:D converts code to C by linuxdoctor · · Score: 1

      Really? That's how C++ got started.

    2. Re:D converts code to C by digitaldaemon · · Score: 3, Informative

      No, it compiles natively.
      Walter Bright, who also wrote the first native C++ designed the language and wrote to compiler for it. The compiler shares the same backend as his C and C++ compiler.

      ManiaC++

      --
      ManiaC++
    3. Re:D converts code to C by noselasd · · Score: 1

      You are indeed right :-/
      It only uses gcc for linking..

    4. Re:D converts code to C by shiftless · · Score: 1

      Ok. This is the same thing Eiffel has been doing for decades, and it's a far better language to boot. So why are people so accepting of this D crap and wary of Eiffel? Eiffel has a couple of minor flaws- but nothing that couldn't be fixed by more programmers, and more pressure on the language consortium to fix them.

  65. I was hoping for more C by mnmn · · Score: 4, Interesting

    Garbage collection? Java-like? I thought the world was finally beginning to hate Java.

    I'm not sick of C at all. I was hoping for more like ANSI C 04 or something (like ansi c99), more low-level, more control, less objects, less behind-the-scenes crap like garbage collection. The quality of code is always higher with C than C++, unless VERY well programmed with C++, and for that reason alone, C code is reused more despite being less reusable. C++ allows for more cheap right-out-of-college employees, while C gives us quality code that lingers for decades. Think UNIX for a second, and give me an example of something in C++ that has lived so long and so well.

    I hate fatter higher-level languages, and we all seem to hate backwards compatibility. If a language has 100 keywords, and you make the next version backwards compatible with 100 more keywords, any sample code can have 200 different keywords in it. Thats making it all tough. C is like RISC, fewer instructions that can be used more creatively, so a smaller amount of code can give you more functionality.

    Its all a conspiracy by computer manufacturers. Say you come up with a language that produces binaries slower than Java, all of a sudden a Pentium 3.0GHz with HT is too slow for it, the market keeps pushing for faster and capitalism works. doesnt matter at all that you can run a file/print/mail/application/web server on a 386sx or an ARM MCU 2mm^2 in size running some operating system made in C.

    --
    "Give orange me give eat orange me eat orange give me eat orange give me you." -Nim Chimpsky
    1. Re:I was hoping for more C by WARM3CH · · Score: 1
      Think UNIX for a second, and give me an example of something in C++ that has lived so long and so well. Very cleaver indeed. You know what, I go even one step further and extend your argument to C#, Java or any other programming languge created after C!
    2. Re:I was hoping for more C by sedawkgrep · · Score: 1

      Computer manufacturer conspiracy influencing or directing the development of new programming languages?

      Man you are completely nuts. bonkers. whacked.

      Honestly - I've heard some crackpot ideas, but this is so far out there, that it scares me that a person could think of something like this in anything more than an anecdotal way.

      --
      Is that a salami in my pants or am I just happy to be me?
    3. Re:I was hoping for more C by andy55 · · Score: 1

      The quality of code is always higher with C than C++, unless VERY well programmed with C++, and for that reason alone, C code is reused more despite being less reusable.

      This is an impressively insightful statement--mod parent up. Indeed, this fact reflects reality, not the "reality" touted by the manufacturers (and the software companies tied to them). If you're a dev and you look back at your years, think of how many C snippets you copied and pasted from example or demo code so that you get up-and-running and have something simple to start from. With OO code bases, that's never possible. Parent has made the best point in this entire thread.

      Steve Jobs once described low level OO APIs really well years ago when Apple was looking doing an OO for medium level OS calls (I can't recall when ir for what codename)... It went something like, using someone elses OO framework when you have your own is like having two buildings next to eachother and having to climb down one and climb up the other, then go all the back every time you wanted to make a system call. If somone knows the exact quote, please jump in--I don't do it justice.

  66. Shenanigans by Anonymous Coward · · Score: 4, Interesting
    features include...garbage collection...full C compatibility
    I'll have to call shenanigans on this, as these two features are mutually contradictory (or at least "real" GC is contradictory with full C compatibility).

    Now before anyone goes on and on about the existence of GC for C/C++, my definition of "real" GC is that it has to be a NON-conservative, compacting, ephemeral collector. Collectors outside this definition have their place: they help you clean up leaks. But they cannot guarantee two features which are crucial to collectors in any modern language: safety and speed.

    Safety. You just can't tell the difference between a pointer and an int in C. Thus there are all sorts of ways of hiding pointers as ints in the language, causing memory leaks. Conversely, if you've encoded a pointer in some way, or have allocated hanging off the edge of a struct (a *very* common occurrance -- Objective-C uses this as its basic objejct storage procedure underneath, or used to) the collector may reap your memory before you're done using it. Ungood.

    Speed. One of the things that makes HotSpot kewl is that it moves around memory as it does collection; as a result long-lived objects get compacted together, taking advantage of cache loads. This can't be easily done in GC if it's not allowed to fool with your pointers safely.

    The point of garbage collection is to be ubiquitous and invisible. This isn't possible in C/C++.

    1. Re:Shenanigans by the_Speed_Bump · · Score: 1

      The article is a bit short on that one. D has full *link* compatibility with C. As in, you can link a C library, do a few extern (C) declarations in a module somewhere, and use it without any further work on your part.

      --
      "Break out the gin, and the small violin, I'm a raging success as a failure." --Firewater
    2. Re:Shenanigans by beegle · · Score: 1

      You just can't tell the difference between a pointer and an int in C.

      There are plenty of bad programmers who can't. Once you start using a platform where int and pointers are different sizes (most compilers for the Alpha, for example), that bad programming really starts to become a hassle. You also see a lot of programs written by people who don't know the difference between big- and little-endian systems, so they try to do "clever" things like calculating array locations by performing boolean addition between ints and pointers.

      You can't say "X doesn't work in C" just because bad programming is endemic in C. Maybe you mean "X doesn't work with the poorly-written programs that make up the majority of C code." There's a difference between "the language doesn't support this" and "the crappy codebase doesn't support this."

      --
      --
    3. Re:Shenanigans by Anonymous Coward · · Score: 0
      You just can't tell the difference between a pointer and an int in C.
      There are plenty of bad programmers who can't.
      Perhaps you misread? The "You" in "You just can't tell..." referred to "the garbage collection system (and its designer)".
    4. Re:Shenanigans by WalterBright · · Score: 1
      One of the things that makes HotSpot kewl is that it moves around memory as it does collection; as a result long-lived objects get compacted together, taking advantage of cache loads. This can't be easily done in GC if it's not allowed to fool with your pointers safely.

      This is very possible to do with D, and the only reason it isn't doing it right now is I haven't spent the time on the GC to make that happen.

    5. Re:Shenanigans by jareds · · Score: 1

      You also see a lot of programs written by people who don't know the difference between big- and little-endian systems, so they try to do "clever" things like calculating array locations by performing boolean addition between ints and pointers.

      Huh? Adding an int and a pointer is perfectly well defined and could easily be used to calculate an array location. That is, it is defined by the standard, and must work on any system. And what do mean by boolean addition?

    6. Re:Shenanigans by Piquan · · Score: 1

      my definition of "real" GC is that it has to be a NON-conservative, compacting, ephemeral collector.

      Why is this? I'm a Lisp hacker, so I work with quite a number of different GCs. I don't particularly think that what you list is required for "real"ness.

    7. Re:Shenanigans by stripes · · Score: 1
      This is very possible to do with D, and the only reason it isn't doing it right now is I haven't spent the time on the GC to make that happen.

      How will you avoid having things who's addresses were once passed to C code move?

    8. Re:Shenanigans by WalterBright · · Score: 1
      There are several ways:
      • Don't pass gc'd pointers to C code, use malloc() for them.
      • Tell the gc about the pointer (it has a function to do this).
      • If the C code is statically linked in, the gc will find the pointer in the stack or in static data.
  67. C++'s successor is already here.... by callipygian-showsyst · · Score: 2
    ...and it's called C#!

    Now before you think I'm nuts, I was skeptical, too. But after programming in C# for the past year, I absolutely love it. The language is perfect. Why design another one? Just make sure good Open implementations get done for it, and leverage all the good design work Microsoft has done!

    1. Re:C++'s successor is already here.... by metalix · · Score: 1

      How about a non interpreted C#? Then you run into problems of people assuming your C# is using CLR and it's not and you have to recompile but it doesn't work and blahblahblahbalhblahbalhb

    2. Re:C++'s successor is already here.... by Anonymous Coward · · Score: 0

      Perhaps decent generics and a more complete operator overloading?

    3. Re:C++'s successor is already here.... by Anonymous Coward · · Score: 0

      someone mod this guy funny

    4. Re:C++'s successor is already here.... by pr0c · · Score: 1

      I exclusivly use C# for EVERYTHING and I too love it. BUT - the largest problem is that you cannot protect your code. Sure in the land of GPL that is no big deal but if I sell a few comercial applications or even a game that I cheating to be much more difficult to do I cannot because they can decompile the code in a second.

    5. Re:C++'s successor is already here.... by Dr.+Shim · · Score: 1

      I heartily agree with you, proc. Especially that C# 2.0 is going to be released... Soon (ahem).

      --
      People discover the meaning of life between getting piss drunk and the following hangover.
    6. Re:C++'s successor is already here.... by saforrest · · Score: 1

      ...and it's called C#!

      That's rather funny, considering that 'D' (i.e. 'D natural') and C# are the same key.

    7. Re:C++'s successor is already here.... by callipygian-showsyst · · Score: 1
      That's rather funny, considering that 'D' (i.e. 'D natural') and C# are the same key.

      BZZZT! Thank you for playing, but you're wrong.

      C# and D are different notes. On a piano keyboard there's a note between C and D. That note is called either C# (if you're in the key of D, A, E, B, F# or C#) or Db (D flat) if you're in the key of Ab, Db, Gb, etc.)

      Now, B# and C are the same note, as are E# and F.

      Leave the music making to the professionals.

    8. Re:C++'s successor is already here.... by kaffiene · · Score: 1

      C# is crap. Its like Java without the portability, consistency and a zillion annoying hard to read features added.

    9. Re:C++'s successor is already here.... by Anonymous Coward · · Score: 0
      Well, I like C# because it wasn't designed by a admitted, convicted pedophile who still makes a lot of $$$ from his Java books.

      If you want to support the rape and exploitation of little girls, that's your problem.

  68. Dropping multiple inheritance ? by DerFeuervogel · · Score: 4, Interesting

    While I agree with many of the changes, I think the dropping of multiple inheritance is probably a mistake. This comes in very handy when defining interfaces for object compartmentalization - as in Microsoft's COM.

    1. Re:Dropping multiple inheritance ? by bradkittenbrink · · Score: 4, Insightful

      Which is why they do include support for interfaces. I don't think you understand the disadvantages of multiple inheritance. I've never found a situation where I actually required the additional functionality that multiple inheritance allows and coudn't be done better with just interfaces. Plus, if you were gonna copy multiple inheritance from c++ you'd need to copy all those nasty casting operators.

    2. Re:Dropping multiple inheritance ? by the_Speed_Bump · · Score: 2, Informative

      This would be a bigger deal if D templates weren't as robust as they are.

      It's quite a simple matter to write template classes that extend their template argument. In this way, you can arbitrarily compose things any which way you like in a way that very closely resembles multiple inheritance.

      Of course, it requires a bit of work, but it's my understanding that implementing MI involves making the compiler very arcane and complicated. One of the goals of D is to be easy for compiler vendors to implement correctly. (no waiting 10 years for a correct compiler!)

      --
      "Break out the gin, and the small violin, I'm a raging success as a failure." --Firewater
    3. Re:Dropping multiple inheritance ? by Anonymous Coward · · Score: 2, Interesting

      With multiple inheritance in C++, there was not a standard way to layout the object in memory. If C inherited A & B, sometimes the objects inherited from A would be allocated first, but sometimes those from B (in the same program). While I can't remember a specific issue that came up from this, it causes non-deterministic behavior, debug vs. release issues, etc. Debugging is hell because of it.

    4. Re:Dropping multiple inheritance ? by shiftless · · Score: 3, Insightful

      Multiple inheritance is awesome and indispensible- when you find a language that implements it well. See Eiffel.

    5. Re:Dropping multiple inheritance ? by slamb · · Score: 3, Insightful
      I've never found a situation where I actually required the additional functionality that multiple inheritance allows and coudn't be done better with just interfaces.

      How about StreamSocket. Okay, multiple inheritance isn't required in the strictest sense, but object-oriented programming isn't, either. MI makes this class make much more sense - it is both a stream and a socket.

      In a language providing only support for multiple interfaces, you'd have to reimplement at least one of those in the derived class. You'd probably end up just dispatching all of the calls in the derived class to a shared implementation elsewhere. Not nearly as clean.

      Or you could pull a Java and have a getStream() method on the StreamSocket. (Make the caller do the dispatching to the shared implementation.) I don't like it either.

      Plus, if you were gonna copy multiple inheritance from c++ you'd need to copy all those nasty casting operators.

      I don't see how eliminating MI makes any of them unnecessary:

      • static_cast<> - still useful. I like saying "make it an error at compile-time if this can be false". Catching errors earlier = more goodness. C didn't have this, but C didn't ever have a way of knowing one structure could be cast to another safely, since it lacked OOness (inheritance, specifically). Also better performance than a dynamic cast.
      • dynamic_cast<> - yup, still useful. A little simplified (it would always return the same actual address or NULL). This is basically what Java's cast is.
      • const_cast<> - nothing to do with MI. (Nonexistant in Java because Java doesn't have constness at all.)
      • reinterpret_cast<> - nothing to do with MI. Necessary for backwards-compatibility with C stuff.
    6. Re:Dropping multiple inheritance ? by Anonymous Coward · · Score: 1, Insightful
      I've never found a situation where I actually required the additional functionality that multiple inheritance allows and coudn't be done better with just interfaces.

      The big drawback to single inheritance with interfaces is that you cannot use derivation to gather implementaions of those interfaces.

      ATL is a very good example. There are a number of standard COM interfaces a COM object must support and the implementations of those interfaces are often boilerplate code. Via multiple inheritance, ATL allows you to combine the interfaces your object will support as well as the standard implementations for those interfaces.

      Achieving the same end with single inheritance usually involves having an aggregate objects which implement the interfaces. Then in your class, you implement each interface to forward the calls to your member objects.

      I admit I don't know D or Java, so perhaps they have some syntax features that make this process easier like:

      interface IWindshield implemented by mWindshieldInstance;

      If you have a better way of combining implementations with single inheritance and interface, then I'm all ears.

    7. Re:Dropping multiple inheritance ? by Anonymous Coward · · Score: 0

      Multiple inheritance is annoying and causes more problems than it fixes. If you really, really, really want multiple inheritance, just use delegation and interfaces and save yourself from the nightmare of MI. Besides, most C++ compilers have a SI model and implement MI as delegation anyway.

    8. Re:Dropping multiple inheritance ? by Anonymous Coward · · Score: 0

      > I've never found a situation where I actually required the additional functionality that multiple inheritance allows

      Good for you. Don't use it. How about not dictating what the rest of us may use, mmmkay?

    9. Re:Dropping multiple inheritance ? by HiThere · · Score: 1

      Multiple inheritance as implemented by C++ has a large number of disadvantages. But to see what it should be, look at Eiffel's multiple inheritance. In this area Eiffel has everything done correctly, and multiple inheritance truely shines! And causes no particular problems.

      If Eiffel didn't have weaknesses to balence it's strengths, it would truly deserve to be the dominant languge. As it is, it just deserves a lot more attention that it has received.

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
  69. Google incompatible by uncadonna · · Score: 3, Funny
    In addition to D, there's another interesting language called J, not related to Java at all but a descendant of APL. And in today's news there's also a story about X.

    Exactly how are we expected to Google for such things?

    Please give your projects distinctive names with more than one character, thanks.

    --
    mt
    1. Re:Google incompatible by iGN97 · · Score: 1

      Speaking of which, don't you just love Microsoft's technologies "COM" and ".NET"? Try googling for that.

    2. Re:Google incompatible by zhenlin · · Score: 2, Interesting

      I call my new operating system \u7985. It is precisely one character, but it says a lot!

      (Also, hats off to anyone who can convice slashdot.org to enable HTML entities in such a way that page-widening posts still don't work)

    3. Re:Google incompatible by avandesande · · Score: 1

      Not so funny.. J is a really cool matrix language

      http://www.jsoftware.com/

      --
      love is just extroverted narcissism
    4. Re:Google incompatible by Anonymous Coward · · Score: 0

      What they need is the language name called 'g string' this way I can get the best of both worlds when i search google: the programming language and the crappy porn which will trojan up and boogle down my machine :)

    5. Re:Google incompatible by unformed · · Score: 1

      well here's one that works, D programming language

    6. Re:Google incompatible by WalterBright · · Score: 1

      Googling for "D Programming Language" or "Programming Language D" works rather well.

    7. Re:Google incompatible by uncadonna · · Score: 1
      sigh. I know how to get *some* hits on the D language, but if I want to use some feature, I can either google for
      D polymorphism
      and get a zillion inappropriate hits or for
      "D programming language" polymorphism
      and miss most of them. I wasn't trying to be funny.
      --
      mt
  70. Fantastic Journalism in this article. by PorscheDriver · · Score: 1, Offtopic
    Hear's the first sentence of the article...

    Nowadays we here lots of hype...

    :-)

    --
    "This is your life, and it's ending one second at a time."
  71. Re:the most interesting part of that table by Anonymous Coward · · Score: 0

    Not only that:

    public void myStuff(){

    if(this.DEBUG_ON){
    System.out.println("Conditional compile for java == true");
    } ...
    }

    Or just run it through an obsfuscator and have everything you don't need removed. Automatically. Why cram everything into the compile tool?

  72. C* by bsd4me · · Score: 1, Informative

    C* actually is a language. It is the C-like parallel language used mainly on Connection Machines.

    --

    (S(SKK)(SKK))(S(SKK)(SKK))

    1. Re:C* by E_elven · · Score: 1, Offtopic

      Isn't that CxC?

      --
      Marxist evolution is just N generations away!
    2. Re:C* by bccomm · · Score: 1

      For those who modded this down (eg. the unenlightened), CxC is a C-subset-ish language designed for scalable cluster programming.

      Just thought I'd point that out.

      ---------
      |\|3+85D: f0r t3h r3a1 133t h4x0r5!!!!!!!!!!1 Those who know will attest! They will agree! They already use it! They will not use annoying hacker-esque stereotypes!

  73. Re:actually, the more important reason for excepti by 12357bd · · Score: 1

    Not so clear, different problems needs different solutions. In my experience (C/asm & Java/C++) the cost of proper error handling is pretty much the same, and is directly proportional to the desired code quality level,not to language facilities.

    What's in a sig?

    --
    What's in a sig?
  74. It's not entirely closed source by the_Speed_Bump · · Score: 4, Informative

    The backend (code generator) for the reference compiler is closed source. However, the frontend is dual-licensed under the GPL or Artistic licenses, and is free in every sense of the word.

    David Friedman has already had success connecting this frontend to the GCC code generator, in fact: http://home.earthlink.net/~dvdfrdmn/d

    --
    "Break out the gin, and the small violin, I'm a raging success as a failure." --Firewater
  75. Because there's a lot of C-code out there by langeland · · Score: 1

    You won't rewrite all your code just because you switch to another language. Reusing existing code is good.

  76. Re:the most interesting part of that table by vt3 · · Score: 1

    The most intersting part of the table is that Limbo was left out. Limbo is the successor to C, not C++, not C#, and certainly not D. For more info, see the following: God Dennis M. Ritchie: The Limbo Programming Language. http://www.vitanuova.com/inferno/papers/limbo.html God Brian W. Kernighan: A Decent into Limbo. http://www.vitanuova.com/inferno/papers/descent.ht ml -- vt3

  77. Preprocessor not archaic, and templates required by Chuck+Messenger · · Score: 1

    I would argue the existence of a preprocessor is not archaic (although I would grant you that C/C++'s preprocessor is archaic).

    Preprocessors allow you to deal with a great range of unanticipated situations -- allowing you to come up with creative solutions to sticky problems. Granted, they can be abused. So what? Don't abuse them.

    The biggest thing I don't like about Java, now that it has templates, is that it's missing a (standard) preprocessor.

    D has 2 strikes against it: first, no templates. Without templates, it's horribly inconvenient to write safe (i.e. strongly-typed) code. Second, it has no (standard) preprocessor.

  78. S, W, X by peter303 · · Score: 1

    S: Bell labs statistical language;
    W: Stanford distributed windows;
    X: Graphics protocol for W (now XWindows).

  79. ABA Games uses D by billcopc · · Score: 2, Informative

    ABA Games, that wacky psychedelic asian dude writes shoot-em-ups in D. I think the D is for Drugs.

    http://www.asahi-net.or.jp/~cs8k-cyu/index_e.htm l

    --
    -Billco, Fnarg.com
  80. Re:D converts code to C - wrong by Anonymous Coward · · Score: 0

    Not true.
    'dmd' is the Digital Mars D compiler.
    It generates native code for windows and linux.
    The frontend for GCC it's a recente and independent project.

  81. OBJECTIVE-C: APPLE VERSION? by tyrione · · Score: 4, Interesting

    Nice to see once more another myriad of articles that espouse all sorts of wonderful capabilities while either due to ignorance or purposeful deception leaves Apple's Objective-C compiler out of the comparison list.

    No matter. All in due course.

    1. Re:OBJECTIVE-C: APPLE VERSION? by JPyObjC+Dude · · Score: 2

      I could not agree more. The OpenStep and OSX developers will have their day in the limelight. Objective-C still has a future and I know when I start doing more app development that I will be using Objective-C in combination with Python and Java.

      Apple has the correct paradigm and it's just a matter of time until other developers realize this. We do not need another language!!

      I would not be suprised if M$ is somehow behind this to further confuse entry level developers....

  82. Java is fast. by Kombat · · Score: 3, Insightful

    You have no idea what you're talking about. I have mod points, and already modded in this discussion, but you are spouting such clearly incorrect nonsense that I feel compelled to respond anyway, lest any newbies actually think you know what you're talking about, and repeat your nonsense.

    What will you use for your low level device drivers?

    C. There you go, congrats, you found one use for C. Now, I ask you: How many low-level device drivers have you written lately? I've never written any, and probably never will. I would wager that over 99% of Slashdot readers are in the same boat as me.

    Or how about that code that needs run fast?

    Sigh. Go read some benchmarks. JIT-compiled Java is just as fast as C/C++ for virtually everything. You are apparently unaware that compilers have been steadily advancing for several decades now, and are actually extremely sophisticated and smart. They are very good at what they do. When you execute a Java program, nothing is interpreted. It is compiled to optimized native code and executed full-speed.

    Actually, in some cases, Java code is faster than C code. When you compile a C program for an x86 platform, you compile to the lowest common denominator. Your compiler cannot assume the presence of advanced instruction sets, like MMX or SSE2. It must restrict itself to outputting code that will run on a 386. A Java interpreter, on the other hand, already knows what platform it is running on, because the native compilation happens at run time, instead of compile time. Thus, it already knows what CPU it is running on, and can take advantage of the precise instruction set availble on the host CPU.

    In fact, the java virtual machine and compiler are both written in C.

    This was the comment that really had me screaming "You IDIOT!" at my monitor. The Java compiler is written in Java, not C. It lives in com.sun.javac.Main. Go look at the "javac.exe" executable. It's tiny. Know why? Because it's nothing more than a native bootstrapper that executes java com.sun.javac.Main <args>. The interpreter is, in fact, written in C. But the compiler is 100% Pure Java (TM).

    Don't believe me? Look disassemble it and look at the code. That should be easy for you, what with your professed experience writing low-level device drivers, eh?

    --
    Like woodworking? Build your own picture frames.
    1. Re:Java is fast. by Anonymous Coward · · Score: 0

      Interesting, Could you care to comment on memory foot print of C prgroams versus an equivalent program which uses garbage collection ?

      Thanks
      -D

    2. Re:Java is fast. by liquiddark · · Score: 1
      When you compile a C program for an x86 platform, you compile to the lowest common denominator. Your compiler cannot assume the presence of advanced instruction sets, like MMX or SSE2. It must restrict itself to outputting code that will run on a 386.
      Apparently, somebody's been keeping up with the basics of the command-line compilers but not the nice GUIs that let us easily manage & optimize for specific build targets.
    3. Re:Java is fast. by mhifoe · · Score: 1

      Your figure of '99%' presumes that all software is aimed at a desktop environment.
      If you need to interface to hardware, or you are developing for an embedded target, Java is not a good choice.

    4. Re:Java is fast. by Kombat · · Score: 2, Interesting

      Are you planning on compiling custom binaries for every platform? Heck, most users have enough trouble deciding whether they're supposed to download the "Windows or Mac" installers. Are you suggesting it is practical to compile your app for every conceivable platform and CPU combination, and allowing your users to select the one appropriate for their configuration?

      With Java, you'd just download the one JAR file. The user already has the correct, optimizing runtime for their platform, and that will take care of optimizing your bytecodes to the proper target platform instructions.

      --
      Like woodworking? Build your own picture frames.
    5. Re:Java is fast. by bestguruever · · Score: 1

      Why not just create an installer that checks the cpu and then downloads and installs the appropriate optized binary?

      --
      if you think this is bad, you should have seen my last sig
    6. Re:Java is fast. by iwadasn · · Score: 1


      Planning to optimize for the platforms that don't exist yet? Some of us want our code to run (and run well) in a year, not just today. And no, moore's law isn't enough. It's expected that code from yesterday should run faster today, not the same speed, when used on better hardware.

      So, compare the performance of a 5 year old binary vs. a 5 year old java program on your spiffy new computer, and tell me which one fares better. Use a modern JVM mind you, and you'll get advanced modern code from the old java file, but crappy code written for an old 386 from the old program.

      Now lest you say that old programs don't need performance, allow me to point you to CLAPACK (written in C no less) and note the fact that it needs performance more than anything, but it's a pain in the A## because you need to be willing and able to recompile it in order to get anything out of it. It also has all the old crappy manual inlining and all that BS. I'm not advocating writing it in java (though I tried parts, it wasn't that bad, but I never got a good comparison) but at least if you did you wouldn't be carrying around decades old BS in a system that critically needs to be very fast.

      I imagine that a java version (even with all the old cruft) would be de-crufted at runtime to the point where it would outrun the 5 year old binary version that is probably embedded in dozens of programs out there. You might even be able to read it without going insane, as well.

    7. Re:Java is fast. by fedtmule · · Score: 1

      Sigh. Go read some benchmarks. JIT-compiled Java is just as fast as C/C++ for virtually everything.

      I have seen some benchmarks comparing Java and C++. None of them resembles how you would actually program in Java. They all use only a minimum of Java. They do not use objects (but only build-in datatypes) and they do not use collection classes.

      Collection classes and I think also objects is part of what makes Java slow. All the cast needed when using the Java collection classes costs time.

      In C++, you do not need cast when using collection classes, as C++ has generic features.

      So please, show me a benchmark which actually resemblems any real Java code.

    8. Re:Java is fast. by po8 · · Score: 1

      You bet. Depends on how many days they've been running. I've rarely seen a complex, long-running C/C++ program that doesn't leak like a sieve. That's after avoiding complex data structures because they're too hard to explicitly manage the memory for. GC-ed programs can leak too (through inadvertent retention of references), but with a modicum of caution they don't in practice---and they are much easier to get correct.

      BTW, in answer to your original troll: with a modern generational GC, there will be an overhead of a few MB for the ephemeral generation, as well as an overall overhead of maybe 20% over a well-designed malloc pool for the rest of the generations. Big deal.

      There is no longer much of a reason to require explicit deallocation in a programming language. I use a lot of different languages for real work---I like the GC-ed ones.

    9. Re:Java is fast. by Anonymous Coward · · Score: 0


      Are you planning on compiling custom binaries for every platform? Heck, most users have enough trouble deciding whether they're supposed to download the "Windows or Mac" installers. Are you suggesting it is practical to compile your app for every conceivable platform and CPU combination, and allowing your users to select the one appropriate for their configuration?



      Numerous methods for CPU model autodetection exist, look it up dipshit. In the *nix world running some code with a SIGILL handler is an easy to knock off method.

    10. Re:Java is fast. by ChrisMaple · · Score: 1
      Your compiler cannot assume the presence of advanced instruction sets, like MMX or SSE2.

      The compiler doesn't need to. Code in C plus assembler can be and has been written to branch to different routines based upon which enhanced instruction sets are available (for example, mjpeg tools under Linux). It's not easy, but it can be done.

      --
      Contribute to civilization: ari.aynrand.org/donate
    11. Re:Java is fast. by Anonymous Coward · · Score: 0
      Planning to optimize for the platforms that don't exist yet? Some of us want our code to run (and run well) in a year, not just today.

      Then distribute source code!!!

    12. Re:Java is fast. by spectecjr · · Score: 1

      That's after avoiding complex data structures because they're too hard to explicitly manage the memory for

      You meant:

      That's after avoiding complex data structures because they're too hard for glorified script programmers who don't understand RIIA patterns to explicitly manage the memory for

      --
      Coming soon - pyrogyra
    13. Re:Java is fast. by Anonymous Coward · · Score: 0

      I've rarely seen a complex, long-running C/C++ program that doesn't leak like a sieve.

      On windows or not?

    14. Re:Java is fast. by po8 · · Score: 1

      Either. I have way more UNIX/Linux experience, though. Do you think there's a major difference of some kind between platforms in this regard?

    15. Re:Java is fast. by ckaminski · · Score: 1

      Yes, that's if:

      1. Your existing JVM doesn't break said 5 year old Java program.
      2. Failing that, you can still find a compatible version of the 5 year old JVM.

      Java is no panacea, my friend. I've had numerous production tools break when we upgraded to another version of the JVM. And with Sun NOT supporting 1.0.7 anymore, I'm not too assured about Sun's long term prospects from keeping my code working.

      What's your point, that Java is a great language, or that bytecode VM's are a good thing? There's arguments for both, but I argue for the VM long before I'd argue that Java is a "Good Thing(TM)"

      Cheers.

    16. Re:Java is fast. by NoOneInParticular · · Score: 1
      Sun's java compiler is indeed written in Java. That's why many people prefer to use jikes: a java compiler written in C, about 10 times faster than the one from Sun.

      So what were you saying about speed again?

  83. Table errors regarding c# by naryco · · Score: 1

    And the comparison is imo clearly wrong in several points, for example regarding c# and arrays. Arraylists and hashtables are part of the .NET base class library, and as such I consider them part of C# also. So how can he say that C# does not support resizable arrays and associative arrays?

    1. Re:Table errors regarding c# by Anonymous Coward · · Score: 0

      and as such I consider them part of C# I ... and he doesn't. Thats where the difference comes in. For that matter, C++'s STL contains resizeable arrays but he doesn't say "Yes" in that column on the table either.

    2. Re:Table errors regarding c# by ChrisMaple · · Score: 1

      Also, the table shows complex numbers being native to C and not (with qualifications) to C++.

      --
      Contribute to civilization: ari.aynrand.org/donate
    3. Re:Table errors regarding c# by ad0gg · · Score: 2, Insightful

      They are ojbect collections. Not a collection of your specified type, until .net 2.0 comes out with generics. It won't have resizable arrays.

      --

      Have you ever been to a turkish prison?

  84. Looks like it's back to printf by NoMercy · · Score: 1

    Seems pretty horrid to me, but all the default examples are of classical C printf() style code, though the operator overloading for > is by seperate functions so there is some possibility for a conversion of whatever string code they use and IO classes to be created using the C++ method, just wish it had been in there by default.

    Though I acknowledge they probably wanted to move away from the hell of one operator having many jobs, but I think a decent IO system for objects is woth it.

    1. Re:Looks like it's back to printf by Anonymous Coward · · Score: 0

      DTL (IO and everything) is still being worked on. D need some smart people to get it right. You can't have everything you want at once in a new language. Now's your chance to get in early, contribute and then say in a few years time. I helped build that.

      There are already several prototype streaming libs avaliable. I build one in half-an-hour.

  85. Nah... by StoatBringer · · Score: 1, Funny

    I think I'll wait for D++.

    --
    Cress, cress, lovely lovely cress
  86. I'll beleive it when.... by OctaneZ · · Score: 1

    I can build gdc with gdc
    (gdc??? huh? why, the GNU D compiler of course)

  87. Re:Preprocessor not archaic, and templates require by bradkittenbrink · · Score: 1

    I don't get it, what is wrong with D's templates. Admittedly, I haven't used D, but it sounds like it has templates to me...

  88. These names.. by stateofmind · · Score: 1

    Why a one letter name? Searching for "D" for help, reference, etc.. will be a major pain.

  89. Convert and then compile... by ciupman · · Score: 1

    ... The whole linux kernel with D and then i'll check it out!

    --
    I fuse with Mercer every single day...
  90. Limbo is the only legitimate successor of C by CondeZer0 · · Score: 4, Interesting

    The clear successor for C is Limbo.

    Limbo was developed in Bell Labs by the the same people that created Unix, C, and Plan 9, and someone once described it as "the language the creators of C would have come up with if they had been give and enormous amount of time to fix and improve C", that is exactly what Limbo is.

    Dennis M. Ritchie: The Limbo Programming Language
    Brian W. Kernighan: A Descent into Limbo

    Together with Inferno, Limbo forms the best platform for distributed applications.

    Inferno and Limbo were recently released under an open source license and you can download them here:

    http://cgi.www.vitanuova.com/cgi-bin/www.vitanuova .com/idown4e.pl

    Inferno/Limbo are the only hope for some sanity in the software industry!

    Best wishes

    uriel

    --
    "When in doubt, use brute force." Ken Thompson
    1. Re:Limbo is the only legitimate successor of C by Dawn+Keyhotie · · Score: 2, Informative
      To quote from the lead-in to your referenced documentation by Kernighan:

      "Limbo is strongly typed, provides automatic garbage collection, supports only very restricted pointers, and compiles into machine-independent byte code for execution on a virtual machine."
      This pretty much disqualifies Limbo as a successor language to C. C is a systems programming language, not a byte-code interpreted play-toy.

      Cheers!

      --
      "The only good windmill is a tilted windmill."
  91. Better tools. by DonGar · · Score: 1

    People keep telling me that Aspect Oriented Programming is the next major step forward. I keep meaning to get around to learning more about it, but somehow I never do. Well, nothing deeper than a one paragraph overview.

    My personal belief is that the next major steps forward are not in languages per-se, but in language and development tools. I suspect that new languages that are fundamentally similar, but without some of the hacks we've all learned to live with will be needed to get the most from these tools.

    --
    plus-good, double-plus-good
  92. Trolling by kyoko21 · · Score: 1

    Perhaps we can all be proud when we get a D++ on our next quantum physics mid-term.

  93. GNOME? by kriebz · · Score: 1

    The poster ends his message with a comment about GNOME development. Now, I love C, but GUI programming is not what it was designed for. How about writing GTK in C++ before we worry to much about needing a whole new language to program in for GNOME. Give C++ a chance.

    1. Re:GNOME? by sglane81 · · Score: 1

      I totally agree that GTK should be rewritten in C++, but there is always gtkmm.

      --
      This is the Internet. You can say "fuck" here. - AC
  94. enumerated types by elbarrio · · Score: 2, Informative
    The comparison list shows that Java doesn't have enumerated types. Thought it was worth mentioning that java will soon have enumerations in release 1.5:

    java 1.5 spec

    1. Re:enumerated types by reapermane · · Score: 1

      Arh java. Still following in D's foot steps .

  95. Re:Because there's a lot of C-code out there by Anonymous Coward · · Score: 0

    The question is how much significant reuse is actually occuring in C programs? If by reuse you mean rewriting existing apps in a new language, that often doesn't pay off.

  96. They may want to change the name... by buddhapkt · · Score: 1

    I have worked with an old D language from Teleuse it is much like VB is to windows... http://mbi.dkfz-heidelberg.de/helios/doc/manuals/m ips/chapter4.html

    1. Re:They may want to change the name... by reapermane · · Score: 1

      I couldn't find that link. How old is it? D was started in 1999.

  97. Inaccurate comparison sheet by AArnott · · Score: 3, Informative

    Whoever put the comparison sheet of D, Java, C#, C++, and C together needs to be more careful. It claims that C# has no inner classes. Which it currently has. Also the comparison sheet claims many things are unique to D, which in fact are supported by the C# 2.0 specification. "C# 2.0 isn't here yet" you say? Neither is D. In fact, the D spec is only at rev. 0.8x.

    1. Re:Inaccurate comparison sheet by the_greywolf · · Score: 1

      then email DM and tell him where the comparison is wrong and show him why.

      didn't you see the email button at the bottom fo the page?

      --
      grey wolf
      LET FORTRAN DIE!
    2. Re:Inaccurate comparison sheet by AArnott · · Score: 1

      I already did just that.

      I pointed it out on this list to warn others that the information may not be accurate. I don't have the time to check everything. This guy posted info he was not sure about.

  98. Re: Fads by Decameron81 · · Score: 3, Insightful

    I agree with your post on most of your points.

    However I just look as this forum and I can't fail to notice that most of the mainstream languages are so because of what they can offer to a certain target of people. For instance you can see how C / C++ remain unbeaten in the low-level programming field. A friend of mine told me perl is used a lot in science (and web programming as well). Something like Java is quite useful for multi-platform development. Visual Basic makes fast development for Windows true. And of course other languages have their purposes too.

    So to put it simple, I get the feeling that the future will divide programmers into different fields of programming. Much more than we are split now, that is. So I am not sure that the "wave of the future" will be just one winner, like it's been in the past. I already can see that there are several winners for several different reasons.

    My 2 cents,
    Diego Rey

    --
    diegoT
  99. Within 1/10 second is NOT ENOUGH by tepples · · Score: 1

    "Pause times below 1/10th of a second are often the case"

    What if I need to respond to an event within 1/120 second? This happens very often in the video game field, which qualifies as a soft real-time[1] field, and it happens even more often in hard real-time fields such as anything related to robotics. Do there exist useful real-time garbage collecting algorithms? If so, are they at least 20 years old so as not to be encumbered by a subsisting patent?

    [1] Another Slashdot user once criticized my use of "soft real-time." I define it as a guarantee of no deadline misses exceeding x milliseconds and fewer than y deadline misses per hour, for values of x and y depending on the application, as opposed to hard real-time where x = y = 0.

    1. Re:Within 1/10 second is NOT ENOUGH by be-fan · · Score: 1

      There are numerous algorithms for real-time GC, though I don't know of any open-source implementations.

      --
      A deep unwavering belief is a sure sign you're missing something...
  100. I liked Amiga E a lot. . . by Zobeid · · Score: 1

    Many years ago, Amiga E was the first OO language that I learned -- after trying and failing to understand C++. E not only made OO concepts easy, but it also had great, readable syntax. Some people say syntax doesn't matter, but I was able to read E code easier and faster than C code, even though at the time I had far more experience with C. I still have a fond memory of Amiga E, and I wish there was something else like it in widespread use.

    So what happened to E? It never got ported from Amiga to other systems. Much of the compiler was coded in 68000 assembler, and much of the documentation was concerned with accessing Amiga APIs.

    Another factor was ambivalence on the part of its creator, Wouter van Oortmerssen. His hobby was designing and implementing new programming languages, he cranked out one after another. It seems he never became too attached to any one of them. After he got Amiga E working the way he wanted, he lost interest and started working on the next language. I guess he didn't consider advocacy to be a productive use of his time.

    It's a pity, because as someone else here pointed out. . . A language that isn't widely available or widely used doesn't do much good, no matter how well designed it may be.

    I'm on a Mac now, so I'll probably use Objective C and call it good enough.

    1. Re:I liked Amiga E a lot. . . by Anonymous Coward · · Score: 0

      yeah as a programming wannabe i found amiga E to be quite easy to understand.
      i think programming on the amiga was ruined by MUI. im saying that from a users point of view, ive no doubt the lazy, sloppy shareware greedy coders loved it.
      other lost gems of amiga third party software; lzx, (ok it had a dos version) xpk, directory opus 4, amos, thor, digibooster, etc

    2. Re:I liked Amiga E a lot. . . by padzo · · Score: 1

      LZX was stolen (well, the coder was employed) by Microsoft. It became part of their CAB compression tool. What a great compression algo it was, especially at the time.

      --
      If M$ is the solution, can we have the problem back?
  101. Re:actually, the more important reason for excepti by jbellis · · Score: 1

    You're not making sense. Remember, if you don't have exceptions, EVERYthing has to go into the return value, and that's what I'm talking about. It's not a pretty situation.

  102. Re:actually, the more important reason for excepti by jbellis · · Score: 1

    Uh... no. In modern languages, that's a non-issue.

  103. $var by Anonymous Coward · · Score: 0

    Is it an integer? Could it be a string? A character? A float perhaps?

    Perl mocks you...torments you, the cast dependent coder. Lick it up.

  104. Screw More Languages by 4of12 · · Score: 3, Insightful

    After Java and C#, why do we need yet another rendition of "what C should have been"?

    As far as I'm concerned the standards for C (89,99) are a reasonable place for this language given all its history.

    More than anything else we need more standardization of libraries, in the same vein as libc or the STL, but updated to include almost 20 years worth of experience with all kinds of drivers.

    • Java provides these and cross-platform which is really nice, but Sun effectively owns final say on the standard.
    • Microsoft provides libraries, but MS owns the standard and changes it around for various marketing purposes.
    • Apple provides nice libraries, but they own the standard and they don't seem to want to open it up.

    Programmers don't need a new language as much as they need powerful, open, standardized, updated libraries.

    --
    "Provided by the management for your protection."
  105. D? D?? Read your history! by elhaf · · Score: 2, Interesting

    D? Don't you geeks have any sense of history? The next language in line is P. The first language derived from BCPL was B, then C. Next is P, then L.

    --
    Six score characters.
    Brevity being wit's soul
    I have enough space.
    1. Re:D? D?? Read your history! by elhaf · · Score: 1

      Sorry, here's the link.

      --
      Six score characters.
      Brevity being wit's soul
      I have enough space.
  106. Re:try, catch, finally (return values) by irw · · Score: 1

    The ROOT CAUSE here is in-band error values.

    In the file descriptor world, -1 is invalid, and therefore a good error value.

    NULL is often (void *)0, which is *technically* valid on some architectures (OS notwithstanding). It's just so unlikely a result that it's safe to use.

    A better approach is this:

    int result=some_argument_to_function;

    if(function(&result)==0) { /* handle error */ }

    Unfortunately, there are too many places where the argument you want to pass would not directly accessible or assignment to it is inconvenient.

    Alternatively you could always set and check errno, which should be 0 on no error. This requires and addition line of code to check errors (and programmers, including me, are lazy).

    Moving to out-of-band errors without the above requires cartesian products as return values, which are fine in set theory but would probably choke the average programmer.

  107. Eiffel is the way to go! by Anonymous Coward · · Score: 0

    You, and everybody else reading this article, should have a look at Eiffel.
    I started reading about the language just a few days ago, and I'm very much impressed! I've been a hardcore C++ user for some years now, and after just a few hours of reading I felt ready to abandon C++.

    Although D seems quite nice and has alot in common with Eiffel, it still lacks multiple inheritance. Like every other language I know of except Eiffel. =)

    C# and java is just sponsored crap in my opinion.

  108. Brilliant name by OrangeTide · · Score: 1

    There must only be a few dozen prototypes for programming languages called 'D'. I think every student with a compiler project has considered calling his/her language either D or C--. (there are two "official" C--'s that I know of, use google to find more).

    --
    “Common sense is not so common.” — Voltaire
  109. double d by essreenim · · Score: 1

    ..because big is best!!

  110. MOD PARENT DOWN - BOGUS by Progman3K · · Score: 1

    I am a c/c++ programmer with 15 years experience.

    I programmed professionally for two years in Java.

    I DIDN'T drop c/c++, because I found Java to be a toy language and really bad at interfacing with the real world. Hardware, real-time algos, etc...

    On the other hand, I STRONGLY recommend teaching Java to computer-science majors, as its restrictiveness (vis-a-vis c/c++) keeps them focused on proper application design and universal computing paradigms.

    So Java is NOT worthless, but it nowhere near being a fitting successor to c/c++.

    --
    I don't know the meaning of the word 'don't' - J
    1. Re:MOD PARENT DOWN - BOGUS by AKAImBatman · · Score: 1

      Many of the developers who pushed Java early on (myself included) did so because they would rather have developed in a clean language like Java instead of the overly complex C++ language. C has been kept around for hardware interfacing and systems programming (where it always worked best anyway) but many programmers prefer Java for all high-level work.

      Just because you happen to disagree with that statement does not make it bogus. If you have something to say, you can say it without attack. I am most ready to listen to other's opinions.

      I DIDN'T drop c/c++, because I found Java to be a toy language and really bad at interfacing with the real world. Hardware, real-time algos, etc...

      Java is hardly a "toy" on the server side. Developing a scalable, error trapping and isolating, run-time dynamic, secure C++ server would be difficult to say the least. Java provides all these features out of the box. C++ developers would have to define a framework, then walk around with a stick to make sure that everyone stays within the framework. The first idiot junior programmer to touch your system (and you know the type I'm talking about) will cause your system to have a hard down condition every time his code is executed.

    2. Re:MOD PARENT DOWN - BOGUS by Progman3K · · Score: 1

      No disrespect intended, Bats,

      Everything you said IS true.
      And YES, doing the same thing in c/c++ requires more discipline, but then, when did this become about lowering the bar constantly?

      I thought we were supposed to master our art right into the very electrons if necessary and provide industrial-strength, efficient solutions.

      Sometimes I think the .COM boom (I equate the PC revolution to it, possibly wrongly) was a curse.

      I have 20+ years of programming experience, you see. The reason I say I have 15 is because at the beginning there, it was incredibly hard to find a job. Jobs were very scarce.

      When things boomed, it brought another effect; people (managers, executives and the like) looked for the easy way out. Faced with even more opportunities, but less programmers, the result was the bar being lowered and all these toy languages being invented.

      I'm not saying you can't do good things in Java, but it's like scratching your belly-button while wearing boxing-gloves.

      A decent c/c++ programmer will get you the same result, and it'll be leaner in its resource requirements, faster in execution, etc...

      Why lower the bar more and introduce even more noise? Humans have a tendency to let things slide until there's a crisis.

      The solution isn't EASIER languages, it's getting the young people who really feel like it's their path to ramp up with the knowledge they need.

      Where are the apprenticeships? Back in the day, you were an apprentice for a long time BEFORE you got to touch production-level code.

      Now, if you've got six months scholastic training in Java and are willing to work for peanuts, you can get a job writing production code in any java shop.

      Don't you see where this is headed?

      Soon it'll be a lot like newspeak (1984):

      More and more, complex ideas will be made obsolete by new programming techniques, developers will get lazier and lazier. Knowledge will be forgotten.

      When it will all break down, there'll be no one that remembers how anything works.

      --
      I don't know the meaning of the word 'don't' - J
    3. Re:MOD PARENT DOWN - BOGUS by Zebra_X · · Score: 1

      I programmed professionally for two years in Java.

      When 1997?

      I don't like java for a number of reasons. However your statement that java is really bad at interfacing with the real world is completely false.

      Java is now embedable in a number of hardware devices. It runs on chips that have A/D converters and Serial communication lines that are accessible by an embedded JVM aka TINI. That's about as close to real world as you can get. As far as real-time java is concerned, for something such as a missle guidance system - well that's still out there.

      There are also a number of Cellular phone manufacturers who have chosen j2me as a platform for deploying their applications. That's another area that is very real world as well.

      I'd say that java is pretty damn flexible these days.

    4. Re:MOD PARENT DOWN - BOGUS by AKAImBatman · · Score: 1

      And YES, doing the same thing in c/c++ requires more discipline, but then, when did this become about lowering the bar constantly?

      It's not really about lowering the bar. Managers try to make it about lowering the bar, but it's really about better structure, reliability, and security. Unfortunately, those same features can be used for a short term gain, while spelling a long term system collapse.

      A decent c/c++ programmer will get you the same result, and it'll be leaner in its resource requirements, faster in execution, etc..

      Let's be honest here. The dynamic code loading abilities alone would take a tremendous number of resources, even for an experienced developer. A security framework like Java's simply couldn't be forced upon the system, and exception trapping in C++ still can manage to allow things like general protection faults which will kill the program dead. (e.g. Null pointers are a common source of GPFs.) Java does not suffer from these issues. A null pointer will put one user of the system out of commission, but the rest of the system will continue on. And hot-deploy capabilities can be used to fix the faulty code without impacting users. This leads to higher availability than a C++ system could easily offer.

      Where are the apprenticeships? Back in the day, you were an apprentice for a long time BEFORE you got to touch production-level code.

      When the people paying for code believe that it's just a matter of throwing more people at the problem, you end up with issues like the DotCOM boom and the Indian outsourcing. It *looks* cheaper on paper, but it will easily kill the company in the long run. I think that a lot of large companies are going to have to die or reach near death before the message will get through. In the meantime, I fear for the US and world economies.

      More and more, complex ideas will be made obsolete by new programming techniques, developers will get lazier and lazier. Knowledge will be forgotten.

      Thankfully, there will still be people like you and I left. As the large companies enter collapse, we'll be right there starting or supporting small companies who will fill the vacuum.

    5. Re:MOD PARENT DOWN - BOGUS by zarr · · Score: 1

      I'm not saying you can't do good things in Java, but it's like scratching your belly-button while wearing boxing-gloves.

      So, you prefer scratching your belly-button with a chainsaw?

    6. Re:MOD PARENT DOWN - BOGUS by Progman3K · · Score: 1

      It's like VB, Java and all high-level languages introduce unnecessary layers between me and what I'm trying to accomplish.

      So I'll respond to your troll zarr, with another analogy:

      When I make love I don't want ANYTHING between myself and my partner.

      Have fun.

      --
      I don't know the meaning of the word 'don't' - J
  111. What about Objective C? by leandrod · · Score: 1

    Not being a programmer, I always thought Objective C to be the nicer OO C alternative, having been eclipsed by C++ and its derivatives for marketing reasons.

    So the question is, how would D compare to Objective C?

    Obviously a deeper question would be why insist on C derivatives instead of going functional and relational... once one's already smoking stuff...

    --
    Leandro Guimarães Faria Corcete DUTRA
    DA, DBA, SysAdmin, Data Modeller
    GNU Project, Debian GNU/Lin
    1. Re:What about Objective C? by Zobeid · · Score: 4, Insightful

      As best I recall, both Objective C and C++ were introduced about the same time and for the same purpose: to add OOP support to C. For some reason the marketplace chose C++ and made it successful and widespread while Objective C languished. Why? I have no idea. . . From my admittedly limited experience with both languages, Objective C appears to be a lot easier to work with.

      I agree that the world doesn't need yet another extended C. If you're going to build a modern buzzword-compliant language, build it from scratch!

      Considering the era C came from, it's a fundamentally good procedural language. Not perfect. Probably not even great. Just good.

      In particular, its terse syntax and heavy reliance on operators instead of keywords makes C code dense and hard to read. You can write readable C code, but it takes a conscious effort, some documenting, and some discipline *not* to use every clever coding trick that pops into your mind. (I've read one opinion that C really stands for Clever, because it encourages you to do all sorts of excessively clever things that you'll later regret.)

      The reason why the whole software industry seems hell-bent on created mutated versions of C, several decades later, is beyond my understanding.

    2. Re:What about Objective C? by Anonymous Coward · · Score: 0

      If you're going to build a modern buzzword-compliant language, build it from scratch!

      This is almost what D does. C++ will never get to the stage of D because it holds to many legancy rules in it. In effect C++ hands are tide to old C++. D is not.

      However D does build on alot of the wisdom found in many different languages. Ada, pascal, C++ (of couse), java, basic.

  112. Re: Fads by Anonymous Coward · · Score: 0

    And it doesn't seem to have done me much harm.

    We will be the judge of that!

  113. Re:Because there's a lot of C-code out there by langeland · · Score: 1

    No, what I mean is that it is nice to be able to use the code you have already written in C. It is not uncommon that current versions of applications are based on C-code that was written 10+ years ago. If that code works you wouldn't rewrite it using D. It could easily pay off to to switch to a programming language which both lets you reuse that old code with a minimum of work and lets you produce new code faster on top of it.

    If D wasn't compatible with your old C-code at all, switching to it wouldn't be an option.

  114. fscking linelength filter by Anonymous Coward · · Score: 0

    Two CS freshmen up hacking all night, hacking all night, hacking all night
    Two CS freshmen up hacking all night, hacking all night, hacking all night

    Gonna hack... Keep hacking...
    Gonna hack... Drink caffiene

    Gonna hack Gonna hack Gonna hack Gonna hack Gonna hack Gonna hack Gonna hack na na na

    Enh enh enh enh enh enh, na na na, Enh enh enh enh...

    You think you're a programmer? Well you've never used a debugger before / You're a newbie! Here's news, kid: / If you wanna hack code you need to debug it / 'cause your code will have bugs and you'll need to fix it

    So your process is stopped on an infinite loop / On some operation where an iterator's not incrementing / And when you fix that bug you get segmentation faults / 'cause your strings are not NUL-terminated

    Hey! It's no time to get frustrated / 'cause your CS 10 course left you uneducated / I know your boss wants it done tomorrow / So here are some programming tips you can borrow

    When you're doing something this easy / The bug won't be in gcc / So try to track it down with gdb / And I hope you compiled with -g

    So, come on kid, print out your listings / Sit down, load the core file and fiddle the bits / Set breakpoints, and check all your branchings / And check all of the values in memory

    Now if you want to hack in C / Then you'd better learn gdb / 'cause you'll dump core eventually / And I hope you compiled with -g
    I said, if you want to hack in C / Then you'd better learn gdb / 'cause you'll dump core eventually / And I hope you compiled with -g

    Little hackers, beginner programmers / Embarassed your teachers are still using Windows? / You don't need Linux to find out why you're crashin' / Use CygWin or MingWin and pretend it's a penguin

    Dev-CPP's a nice IDE / It's not Anjuta, but it works for what you need / No floppies, keep your software on the 'net / And get it with Putty 'cause you don't know CVS

    A bash script can't necessarily / be used on tcsh or ported from Be / And Perl? It's like blowing in your modem / *pfft* -- look, it's a regex! You can't debug that

    And nobody can write standalone apps in PHP / Does anyone even use Python or Ruby? / There's no reason to code in assembly / These days when you can do it in C

    *pfft* Attention PHBs / C++ is something you don't need /Too complex, you might as well use C / printf() just has cout plain beat

    Now if you want to hack in C / Then you'd better learn gdb / 'cause you'll dump core eventually / And I hope you compiled with -g
    I said, if you want to hack in C / Then you'd better learn gdb / 'cause you'll dump core eventually / And I hope you compiled with -g

    Now Visual Basic's a piece of shit / Even the data validation functions crash / in it, a piece of trash language / ASP's begging to have your website hacked

    And Java? It runs as slow as lava / The VM takes an hour to load / And configuration, you get write once, run nowhere / The FHS ain't that hard to follow

    And C# is an obvious ripoff / Its Java without the interoperability / So big deal, it does XML like everything else / MS sycophants pretending it's something respectful

    There are some times it seems to me / That everybody ought to hack in C / This must mean that C is neat / And C is not yet obsolete

    Hey, I'm not saying that C is supreme / It lacks garbage collection and some other things / Just know what language features you'll need / And use whatever will provide these

    So hey, here's a concept that works: / Twenty million computer languages emerge / But no matter how well they fit your needs / There will always be a place for C

    And if you want to hack in C / Then you'd better learn gdb / 'cause you'll dump core eventually / And I hope you compiled with -g
    I said, if you want to hack in C / Then you'd better learn gdb / 'cause you'll dump core eventually / And I hope you compiled with -g

    Na na na na na... Na na na na na... Na na na na na... Na na na na
    Na na na na na... Na na na na na... Na na na na na... Na na na na

    1. Re:fscking linelength filter by zobier · · Score: 1

      Kudos to both you guys for your rhymes, but shit, I can't read anymore comments properly 'cause I'm trying to find the non-existent rhythm/rhyme.

      --
      Me lost me cookie at the disco.
  115. Sigh... by Anonymous Coward · · Score: 0

    Dammit, just use C++ and stop bitching willya??

    Sheesh, it's been 10 years already.

  116. MOD PARENT GENIUS! by Progman3K · · Score: 1

    That is the coolest thing I've read in a while.
    Did you write it? Kudos.
    It's truly swell.

    sig - I've upped my karma, so now up yours.

    --
    I don't know the meaning of the word 'don't' - J
  117. at a glance a problem by iplayfast · · Score: 1, Flamebait

    From the page, here is some sample code of an "out" type parameter. (Think of it as a one way reference)

    out parameters are set to the default initializer for the type of it. For example:

    void foo(out int bar)
    {
    }

    int bar = 3;
    foo(bar); // bar is now 0


    The immediate problem I can see with this, is the same as using references in C++. There is no indication in the calling procedure that the variable passed in can be changed by the called procedure. In C, you can only do this by passing pointers, and as such you know that foo(&bar); can change the bar. (or that the variable you are passing in is a pointer, and thus can change what it's pointed too).

    This sort of thing is only important after code has been written, and is now being maintained by other folk. The other folk not being familiar with foo, will have no idea that bar can be changed.

    1. Re:at a glance a problem by ejasons · · Score: 1
      The immediate problem I can see with this, is the same as using references in C++. There is no indication in the calling procedure that the variable passed in can be changed by the called procedure. In C, you can only do this by passing pointers, and as such you know that foo(&bar); can change the bar. (or that the variable you are passing in is a pointer, and thus can change what it's pointed too).
      I'm not sure why the brain-dead moderator modded this as "flamebait" (though my post now pretty much is...). This is a good point, and while some may not agree with it, it is hardly "flamebait".

      For the reason you mentioned, in my C++ code, I never use non-const reference function arguments (and I strongly encourage others to do the same; I think that there should be a g++ warning for this). As you noted, it is important to be able to read code, and have a pretty good idea of what it is doing, without having to look up the definition of every function that is being called. And seeing foo(&bar) versus foo(bar) makes it very evident that the former can change its argument...

    2. Re:at a glance a problem by iplayfast · · Score: 1

      Well, I'm not sure what the moderator was thinking of either. Wasn't intended as flamebait. Oh well... I think I'm going to move from c++ to C# anyways. (It's similar to Delphi (with C syntax), which compiles so fast it makes it a joy to work with!).

  118. Re:actually, the more important reason for excepti by DrXym · · Score: 2, Insightful
    Exceptions in C++ are just horrid. You might catch an exception and but not have the faintest idea who threw it. And C++ doesn't even enforce exception handling - you have no idea if a function throws an exception unless someone declares it explicitly. And the compiler won't care if you don't you put try / catch blocks in for it either. Even worse for Win32 programming are that #imported COM interfaces throw _com_error exceptions rather than return an HRESULT, making it a massive pain in the arse to program ADO or anything like it - a single uncaught exception can kill your app or make it fall out of functionality in a very bad way.


    I have no problem when exceptions are done properly as in Java, but using them in C++ is an exercise in frustration.

  119. Re:Preprocessor not archaic, and templates require by Chuck+Messenger · · Score: 1

    There's nothing wrong with them, except that I didn't know about them... :-)

    Templates are something new for D -- last time it came up on /. D didn't have them. In quickly reading the article, I missed any mention of templates, although going back, I see they were mentioned in passing.

    Thanks for pointing that out.

  120. The problem with so called extensible languages by Anonymous Coward · · Score: 0

    is not everthing is extensible. Not orthangonal. Basically the technique to deal with this is to put a wrapper (bridge and/or factory patterns) on stuff, sometimes lots of stuff. Locks (monitors) is Java is a classic example. You can't override that behavior. So you have to write your own lock class from scratch and then write wrappers for everthing that uses hard coded real monitor locks.

  121. better libs! by protomala · · Score: 1
    What I really think C/C++ need are just better and more modern libraries/includes. There are tons of things that could be included, if they include all the PHP funcions it would be perfect for example. PHP is a gfreat example of how a language is less important than the functions it have.

    Why not include mysql/postgres/etc functions on default includes functions? This would be a major boost for C language IMHO.

    1. Re:better libs! by AlXtreme · · Score: 1

      Sorry to break it to ya, but MySQL, Postgres both have C API's, that other languages like PHP use in order to let em young ones (like you) do all their nifty scripting that make them feel all godlike. Get a clue.

      --
      This sig is intentionally left blank
    2. Re:better libs! by protomala · · Score: 1

      ANSI C? I know borland C++ and Microsoft Visual C++ probally have those things, but does ANSI C?

  122. Dangerous and far too vast? by padzo · · Score: 1
    Is it just me (coming from, and currently enjoying, Java), or does this language reek of unsafe and dangerous programs with potential for some really tricky-to-find bugs?

    For example:

    Dynamic array length

    Yeah, this sounds like a cool feature, but (quote):
    The .length property of a dynamic array can be set as the lvalue of an = operator:

    array.length = 7;

    This causes the array to be reallocated in place, and the existing contents copied over to the new array. If the new array length is shorter, only enough are copied to fill the new array. If the new array length is longer, the remainder is filled out with the default initializer.

    To maximize efficiency, the runtime always tries to resize the array in place to avoid extra copying. It will always do a copy if the new size is larger and the array was not allocated via the new operator or a previous resize operation.

    This means that if there is an array slice immediately following the array being resized, the resized array could overlap the slice; i.e.:

    char[] a = new char[20];
    char[] b = a[0..10];
    char[] c = a[10..20];

    b.length = 15; // always resized in place because it is sliced
    // from a[] which has enough memory for 15 chars
    b[11] = 'x'; // a[15] and c[5] are also affected

    a.length = 1;
    a.length = 20; // no net change to memory layout

    c.length = 12; // always does a copy because c[] is not at the
    // start of a gc allocation block
    c[5] = 'y'; // does not affect contents of a[] or b[]

    a.length = 25; // may or may not do a copy
    a[3] = 'z'; // may or may not affect b[3] which still overlaps
    // the old a[3]
    This is SO dangerous - it doesn't seem like the way forward for a modern programming language. It puts the impetus on the coder to undestand a rather strange side-effect of an efficiency in the language to know that they might accidentally be modifying a different array without realising.

    Another example:

    Out / inout function parameters

    These sound like a nice short-cut to allow pass-by-reference or multiple return values, but also seem dangerous:
    void foo(out int bar)
    {
    }

    int bar = 3;
    foo(bar);
    // bar is now 0
    I have only briefly skimmed the surface of the language, but it seems to me like an attempt to cater for everyone. I fear that, like C++ can be, it will result in too many unknowns and areas of murky understanding. This will in-turn lead to hard to maintain code and the nasty bugs!

    padzo

    --
    If M$ is the solution, can we have the problem back?
    1. Re:Dangerous and far too vast? by reapermane · · Score: 1

      It's just you. You have to have some unsafty if you want performace and full control. Of couse you can define you own safe classes if you wish. D is probably more safe (or I should say more encouraging of safe programming) then C++.

  123. They should have a form for ppl with a C successor by iamacat · · Score: 2, Interesting

    ... like they have for a spam fighters and for physics. Also, wait until the language is tremendously popular before claiming K&R fame and calling it "D". Even Microsoft is more humble.

    Probably the language's greatest goal is the elimination of archaic and/or needlessly complicated features. For instance, D does away completely with the C preprocessor, relying instead on built-in versioning capabilities. Forward declarations are out the window on the same token. Also, it replaces the often-complicated multiple inheritance of C++ with Java's single inheritance and interfaces.

    Thank you very much, but we can already write a program without using the features we don't like. If that's a primary goal of your language (as opposed to side effect of offering some advanced features like GC), I think I'll pass.

    Besides, multiple inheritence is useful and meaningful when your object really both an InputStream and an OutputStream. Duplicating default code or having a A where every method calls B->method is just silly.

    As for C preprocessor, it can be used to do enormous work in a page of code. Like auto-generating stubs for hundred functions that get a mutex, call the original function which is not thread safe, release the mutex and return the original function's results. There are solutions for each specific use, for example Aspect-based programming. But there is still a need for a tool that can more safely extend language's grammer without writting a complete parser first. Until then, let's just use the only one available, but only when templates, aspects and such don't solve the problem. In fact, I want JPP, especially for #ifdef.

  124. It's just a matter of time . . by KenSeymour · · Score: 1

    Before job ads start asking for 5 years of D experience.

    --
    "We can't solve problems by using the same kind of thinking we used when we created them." -- Albert Einstein
    1. Re:It's just a matter of time . . by Anonymous Coward · · Score: 0

      Funny story. When I was graduating college a few years back now. C# was a new thing, out for only a couple years. When I was applying for a job I would often see:
      "Seeking C# developers, 5+ years exp needed" ... C# hadn't been around that long yet. :)

  125. Performance? by tepples · · Score: 1

    Does one pay for "modern languages" in performance? What "modern languages" with free compilers produce binaries that run fast enough on handheld systems with a 16 MHz ARM CPU and less than half a megabyte of RAM? Keep in mind that PC-class systems aren't the smallest useful computer systems.

    1. Re:Performance? by Anonymous Coward · · Score: 0

      Is C++ fast enough for you?

      Just make sure any resouces are handled by constructor/destructor pairs and you are safe from resouce leaks due to exceptions.

      Most of those ctor/dtor's will be one liners that will inline easily.

  126. "E"s and whizz - for hip youth appeal by Curly-Locks · · Score: 1

    It should be called 'E' to appeal to the drug-taking raver youth of today. It would fit the profile of being a more cerebral experience writing the code.

    It might shake up a few offices.
    It should have a set of libraries called Whizz.

  127. Nope, ain't gonna do it. by Zobeid · · Score: 2, Interesting

    10 years of pain and suffering. I feel sorry for those who must code C++, like it or not, to put bread on their table. No, I'm not going to use C++. I'd rather use Objective C. I'd rather use ANSI C. Heck, I'd rather use Java.

    I'd even rather try to bend my mind around Smalltalk. . . the original object-oriented language, in case anybody forgot. Squeak Smalltalk is open source, cross-platform, and seems to be pretty powerful. It's just so damned *alien* though. It's like something that dropped through a wormhole from some alternate reality. (I suspect Squeak would be much easier to learn if I'd never been exposed to any normal programming languages.)

    1. Re:Nope, ain't gonna do it. by reapermane · · Score: 1

      D is probably right up your ally then. It's a cross between al those languages.

  128. They wanted a Microsoft veteran by tepples · · Score: 1

    What that means is that recruiters were looking for somebody who had worked for Microsoft, but regulations prohibited mentioning the name of a specific competitor in the ad.

    1. Re:They wanted a Microsoft veteran by doublem · · Score: 1

      While that's probably one of the common reasons for such requirements, in this case it was because corporate policy required 5+ years experience in any technology before they would hire someone to work with it.

      The recruiter did kindly offer to keep my resume on file as I did have the requisite number of years experience in Windows 3.1, which she found impressive.

      --
      "Live Free or Die." Don't like it? Then keep out of the USA
    2. Re:They wanted a Microsoft veteran by Tukla · · Score: 1
      which she found impressive

      Why? Because you didn't slit your own throat? ;-)

    3. Re:They wanted a Microsoft veteran by Tukla · · Score: 1
      What's the point of hiring former MS employees? Aren't they required to have their memories erased when they leave?

      I can imagine the last step of the exit interview: "Okay, just look at the red light, please."

    4. Re:They wanted a Microsoft veteran by doublem · · Score: 1

      I don't know, but I got the impression hat computer experience beyond basic word processing was akin to voodoo to her.

      There's nothing WRONG with that, in an absolute sense, but someone hiring tech staff really should have some understanding of the technology involved. If all you need to do is edit documents, then those are the only computer skills you need. If you're hiring tech staff you really need to know the difference between a Firewall and a hole in the wall.

      It's not her lack of tech skills I found disgusting, but the fact that she was evaluating my tech skills for a job she didn't understand. It would be like me trying to hire a Warehouse Manager or Auto Mechanic. I have no skills in those areas and no knowledge of what qualifies someone for such a job. It would be a disaster.

      --
      "Live Free or Die." Don't like it? Then keep out of the USA
  129. D as in Delphi? by Anonymous Coward · · Score: 0

    I would like to see the Object Pascal of Delphi in the comparision sheet. It would have a "YES" on most topics too and that with a blazing fast (you have too see it to believe) and stable compiler.

  130. plenty of mistakes by hak1du · · Score: 1, Flamebait

    Inline assembler

    That's an implementation-dependent feature, not a language feature of C/C++.

    Direct access to hardware

    C# has unsafe pointers (in unsafe modules), so it has this feature to the same degree that C and C++ do.

    Explicit memory allocation control

    C# very much has explicity memory allocation control. In fact, C# has similar low-level programming features to C/C++, but it packages them MUCH better.

    Independent of VM, Direct native code gen

    Both Java and C# have implementations that do "direct native code gen", in the sense that you can take source code and have a compiler generate shared libraries. Both languages can be implemented without a VM, although many libraries (and many application programmers!) want the functionality that the VM provides. Where is D's VM?

    Templates

    If he really means "templates", I'm glad that none of the other languages have them. Templates are a specific feature of C++--enormously useful, but very poorly designed. C# has parameterized types, which are less powerful but a better design.

    Support all C types

    I'm not sure what that is supposed to mean. C doesn't have a well-defined set of specific types, it has type names for implementation defined types satisfying minimum requirements. C# certainly has a complete set of types corresponding to that.

    Struct member alignment control

    Not only does C# have struct member alignment control, it has it in a way that is more explicit and better designed than what C and C++ have.

    1. Re:plenty of mistakes by IamTheRealMike · · Score: 1
      That's an implementation-dependent feature, not a language feature of C/C++.

      Not really. To be useful, the language has to be flexible enough to let the asm code talk to stuff written in the higher-level language. How do you do that with Java/C# again?

      C# very much has explicity memory allocation control. In fact, C# has similar low-level programming features to C/C++, but it packages them MUCH better.

      So what? We're talking about D, not comparing C# to C++ here.

      Both Java and C# have implementations that do "direct native code gen", in the sense that you can take source code and have a compiler generate shared libraries

      You've clearly never attempted to actually do this. I have, with Java, and it is far from being trivial, and not all code can even be compiled in this way (typically because it depends on swing or similar libraries which make undocumented calls right into the VM).

      As for C#, I have yet to see a convincing native code compiler. No, pre-JITting is not the same thing, as you still need a ton of supporting framework (and often the original DLLs for the metadata).

      Both languages can be implemented without a VM, although many libraries (and many application programmers!) want the functionality that the VM provides. Where is D's VM?

      What functionality is that then? D appears to have all the features I like from C# and Java (as a language) but without the obnoxious 30mb runtime download for the VM and associated tools. Why, pray tell, do I want a VM in the first place?

      If he really means "templates", I'm glad that none of the other languages have them. Templates are a specific feature of C++--enormously useful, but very poorly designed. C# has parameterized types, which are less powerful but a better design.

      That's wierd. I could have sworn that both Java and C# were getting generics/templates in their next versions.

      Not only does C# have struct member alignment control, it has it in a way that is more explicit and better designed than what C and C++ have.

      Uh, again, you seem to have misread the topic of this discussion - we're talking about D and not C#. You haven't bothered explaining why you think it's "more explicit" or "better designed" than other languages, and the same malady affects your other insights. Stating that C# is the best thing since sliced bread does not make it fact.

    2. Re:plenty of mistakes by hak1du · · Score: 1

      Uh, again, you seem to have misread the topic of this discussion

      No, you have failed to see that I was responding to the comparison sheet that the author of the D language put together and that was linked to from the story. That comparison sheet contained numerous errors and misstatements about C, C++, C#, and Java.

      "[The ability to integrate assembly code into the high-level code is] an implementation-dependent feature, not a language feature of C/C++."

      Not really. To be useful, the language has to be flexible enough to let the asm code talk to stuff written in the higher-level language. How do you do that with Java/C# again?


      As I was saying, none of the languages provide it: not C, not C++, not Java, not C#. Many C/C++ implementations happen to contain that extension, but it's not a feature of the language.

      But I don't see any reason why it should be hard to add to C# or Java if anybody cared to; after all, Lisp had in-line assembly.

      I have, with Java, and it is far from being trivial, and not all code can even be compiled in this way (typically because it depends on swing or similar libraries which make undocumented calls right into the VM).

      I simply stated that the Java language can be compiled that way. Obviously, most Sun Java programs cannot because they rely on numerous proprietary libraries.

      As for C#, I have yet to see a convincing native code compiler. No, pre-JITting is not the same thing, as you still need a ton of supporting framework (and often the original DLLs for the metadata).

      Java and C# have native code compilers that work in non-batch mode. In the case of C#, it's a standard component of Microsoft's platform. No, it doesn't generate standalone code, but that wasn't the point made in the comparison.

      What functionality is that then? D appears to have all the features I like from C# and Java (as a language) but without the obnoxious 30mb runtime download for the VM and associated tools. Why, pray tell, do I want a VM in the first place?

      The ability to load code at runtime, the ability to write software components that work on different CPU architectures even if the main program runs natively, the ability to write portable code transformation tools, and the ability to sandbox untrusted code, among others.

      Besides, you are living in a dreamworld if you think that C or C++ require less space for the same functionality. While I think that Sun's JRE is bloated in terms of how much functionality Sun throws into it, in terms of bang-per-megabyte, the JRE and other VM-based languages are far better than natively compiled languages.

      That's wierd. I could have sworn that both Java and C# were getting generics/templates in their next versions.

      No, C# and Java are not getting templates, but they are getting a parameterized type facility; the comparison table should have listed that but failed to. If D indeed has templates (meaning, the same kind of facility as C++), then that was a lousy design decision.

      Altogether, I suspect that both he and you are simply confused about what templates and parameterized types actually are, although you seem to be confused in slightly different ways from each other.

  131. JIT uses RAM. by tepples · · Score: 1

    Are you planning on compiling custom binaries for every platform?

    No, I'm planning on shipping generic i586 binaries and giving the user the option to compile the source code during the Setup Wizard. Even in the world of proprietary software, many digital signal processing apps and plug-ins for Windows have separate DLLs containing cores for different processors.

    Besides, I often work with small hardware. Does a JIT JVM plus a program both 1. fit into 256 KB of RAM and 2. allow for garbage collection without noticeably interrupting the flow of events that occur at 60 Hz?

    1. Re:JIT uses RAM. by Kombat · · Score: 1

      No, I'm planning on shipping generic i586 binaries and giving the user the option to compile the source code during the Setup Wizard.

      OK, fine. I will concede that in cases where your userbase is intelligent enough to actually know what CPU architecture they are running, and they won't be scared away when an installer says the word "compile," then C can be as fast as Java. :)

      Besides, I often work with small hardware. Does a JIT JVM plus a program both 1. fit into 256 KB of RAM and 2. allow for garbage collection without noticeably interrupting the flow of events that occur at 60 Hz?

      Though I've never used it, and can only quote the whitepapers, it appears Java 2, Micro Edition does in fact meet those criteria, with the possible exception of the JIT compilation.

      --
      Like woodworking? Build your own picture frames.
    2. Re:JIT uses RAM. by tepples · · Score: 1

      I will concede that in cases where your userbase is intelligent enough to actually know what CPU architecture they are running

      Easy. Sniff the user agent and move the version matching the user's platform to the top.

      it appears Java 2, Micro Edition does in fact meet those criteria

      Thanks. I wonder if anybody has actually tried to make a GBA game in J2ME without an aJile coprocessor.

  132. You should give some of the fads a try by iamacat · · Score: 1

    I used to write in FORTRAN and assembler. And then I tried C and realized I don't have to switch languages so much to do system-level programming and besides preprocessor and generic for loops are neat.

    Then for the longest time I refused to touch C++, because I could do everything with structs, function pointers and longjmp. Now I look at my old code and think "what the hell...?".

    A lot of fads do make you more productive if you really get into the mindset and learn the available tools. So far, I am holding out against Perl, anything that starts with X and ends with L, complicated forms of source control, formal design procedures and modeling tools. I also tried Java and wish it didn't miss so many essential C++ features (like reference function parameters and automatic destructors for local variables) to make using it such a trade off. I tried C# and many features are still missing and others feel like they were slapped on rather than a natural part of the language.

  133. Handheld devices by tepples · · Score: 1

    There you go, congrats, you found one use for C. Now, I ask you: How many low-level device drivers have you written lately?

    Programs for some handheld systems contain customized video drivers and sound drivers. I had to write my own display and sound drivers for these demos. Do you know of a better language than C for implementing soft-real-time graphical video games on a device with a 16 MHz CPU and 256 KB of RAM?.

    1. Re:Handheld devices by jbester1 · · Score: 1

      When you have a so few resources you might want to look into implementing a small forth kernel (usually comes out to be 5-10k) and developing using forth. It's designed for soft real time applications and extremely compact program size.

  134. var # dynamic typing w/o the funky punctuation by Anonymous Coward · · Score: 0

    ...as does Python ;-)

    (is it an integer, a string, a list, an enormous enterprise scale application encapsulated in one object?)

  135. you're mistaken by hak1du · · Score: 1

    For those of us who don't like unpredictable... pauses... in our programs

    You're mistaken if you think that by using "manual" storage management, you get intrinsically lower latencies or better memory management performance.

    The only reason C/C++ allocators seem to perform better is because they are mature and widely used, and have been extensively tuned. But early BSD malloc implementations would sometimes go away for minutes at a time. Using "manual" storage management gives you no real time guarantees. And, if anything, it has an intrinsically higher overhead than equivalent garbage collected code.

    So why complicate things with garbage collector and tracking down circular references and unpredictable pauses?

    Garbage collectors have no problem with circular references (but many of those C++ memory management hacks you advocate very much do).

    And if you don't like unpredictable pauses, then you need a real-time memory allocator. Those exist in both manual and garbage collected varieties. If all you want is soft real-time performance (interactive), then most good manual allocators and most good garbage collectors will do the trick.

    Gosh, this is 2004 and arguments like yours were bogus even back in the 1980's. Get with the program.

  136. #include <windows.h> by tepples · · Score: 1

    I agree with most of your points, but there's a reason Microsoft implemented precompiled headers in its compiler:

    Ever hear of "Make" and "Makefiles"? You don't need to keep recompiling things than havn't changed.

    Even with GNU Make, sometimes even a single module takes too long to compile on some older but paid-for workstations, especially if it has to include the platform's all-inclusive API header file. Or has Microsoft broken up <windows.h> into separate headers yet?

  137. Re: Fads by anomalous+cohort · · Score: 1
    If you want to make a career out of always having the skill that's in demand, keep in mind that the only reason the skill is in demand is because it is rare--and you'll need to be quite clever at guessing the next fad

    That's true. Isn't that the secret of success? You must learn to take opportunities before they become general knowledge. To a degree that means being able to predict the future.

    When you choose what you want to learn, what investments you want to make, what company to work for, it is always with an eye to the future. Investing a lot of money, time, or mind into something that has no future is not a recipe for success.

  138. Re:Hardware problem? by iwadasn · · Score: 1


    Actually, I was thinking about exactly that problem..... though I am perhaps a bit of a crackpot.

    Here's what I figure. A device driver is really two parts. one part actually reads from and writes to the device, the other part is the actual code. The reading and writing part could be handled by allowing some sort of low level VM call (assuming the VM is somehow embedded in the OS, so you can have this sort of access, it would also have to run in system mode). Basically some sort of native code takes care of the bindings and then loads up your driver with some sort of context object that contains (perhaps) a bunch of byte[] objects that represent the memory the device driver will use to communicate with you. These arrays are pinned in ram, so they always exist at the right location.

    Then you write your driver, use the byte[]s to communicate, are guaranteed that your memory addresses are always correct (if they started out correct) and all your code is safe. In addition, it would be nice if when you driver threw an exception (should never happen, but who knows) the System should just re-initialize the driver and reset the hardware (works better on video cards than harddrives, but I'm not a hardware hacker, so cut me some slack) and continue.

    Basically, what I'm saying is that an OS should include a VM in system mode, and then throw everything possible into the VM to get security and protection. Even most of the device drivers could go into the VM (using a technique somewhat like that above) and leave only the basics of scheduling/memory management in the kernel. Less kernel code means fewer crashes (less code in system mode that can take down the system, especially the drivers), and Java programs could run in system mode (substantial performance increase) while native apps could run normally.

  139. Re:the most interesting part of that table by Anonymous Coward · · Score: 0

    i believe that the original posted intended to say that Java is as dead as BSD is. BSD is not dead. Nor is Java.

  140. Re:actually, the more important reason for excepti by cheide · · Score: 3, Informative

    Oh! sure, nice, but then the problem is with resources allocated on those 3, 5 or 10 'skipped' levels during exception handling.

    Most resources *should* automatically free if they were allocated on the stack, wrapped in an std::auto_ptr, or a guard class whose destructor will do whatever's necessary.

    If one of those layers has a resource it knows has the potential to leak anyway, it can add its own exception handler, catch the exception on its way back, release the resource, and then rethrow the exception.

    Of course this is still the fundamental problem with languages like C++ -- it works great, *if* you have the discipline to do it properly in the first place...
  141. No, heres what's most interesting: by sesaetaen · · Score: 1

    The most interesting is why the Founder of D feels it is necessary to compare his language to other languages.

    Quote from Bjarne Stroustrup's FAQ: "When looking at a language comparison consider who wrote it, consider carefully if the descriptions are factual and fair,
    and also if the comparison criteria are themselves fair for all languages considered. This is not easy."

    I tend to agree. A comparison table biasing the featured product makes me feel somewhat suspicious.

    Moreover, some of the features where C++ is listed as 'No' are available although GC'ing isn't something I miss much about C/C++

    1. Re:No, heres what's most interesting: by reapermane · · Score: 1

      It's difficult to write an unbiosed table. Anyone who wants to write an unbiosed table must not be in love with any particular language or hate any particular language but must know each language well. Where do you find such a person?

  142. Nice Comparison by Elladan · · Score: 3, Interesting

    Heh.

    Nice feature comparison, except for the fact that it's wrong. Perhaps the authors of D would do better if they actually learned C++ first? Designing a new language when you're clueless is the first sign of disaster. Look at Java.

    Resizeable arrays: D Yes, C++ No

    BZZT.

    Arrays of bits: D Yes, C++ No

    BZZT.

    Built-in strings: D Yes, C++ No

    BZZT.

    Array slicing: D Yes, C++ No

    BZZT.

    Array bounds checking: D Yes, C++ No

    BZZT.

    Associative arrays: D Yes, C++ No

    It's called a map.

    Inner classes: D Yes, C++ No

    BZZT (perhaps they meant specifically the automatic parent resolution?)

    typeof: D Yes, C++ No

    BZZT.

    foreach: D Yes, C++ No

    BZZT.

    Complex and Imaginary: D Yes, C++ No

    BZZT.

    Struct member alignment control: D Yes, C++ No

    Give me a break, every C++ compiler supports this. It's just implementation defined.

    Now go look at D's page on Design By Contract in C++: here

    Notice that any C++ programmer can come up with a far better implementation than theirs using child class destructors and inlining. In fact, Stroustrup even put one in his book in case you're having trouble getting the brain in gear.

    The comparison list combines cluelessness and sophistry ("C++ doesn't have this feature! It's in the STL, not the language" - oh please) to try to promote their own half-baked language.

    Conclusion:

    Yet another half-baked useless language.

    1. Re:Nice Comparison by kundor · · Score: 1

      > Resizeable arrays: D Yes, C++ No
      >
      > BZZT.

      Declaring a new array, copying the data over, and deleting the old one is NOT resizing an array.

      > Array bounds checking: D Yes, C++ No
      >
      > BZZT.

      Oh? Funny how declaring a 10-element array and writing to element 10 works then.

    2. Re:Nice Comparison by SchroedingersCat · · Score: 1

      Perhaps you need to take another look at at std::vector

    3. Re:Nice Comparison by Old+Wolf · · Score: 1

      C++ does not have "typeof". I understand it's slated for looking at by the ISO committee, but it'd still be a fair way off before it came in. Some compilers support it as an extension (I wish more did).

      Example use:
      std::vector<std::string> vec;
      typeof(vec)::iterator i = vec.begin();

      (so you can declare iterators and so on, and then change from vector to deque later and not have to change all your code)

    4. Re:Nice Comparison by jareds · · Score: 1
      • Inner classes: D Yes, C++ No

        BZZT (perhaps they meant specifically the automatic parent resolution?)

      BZZT -- The page even had "nested classes" listed separately and a note linked from the words "inner classes" explaining the difference. Obviously if "nested classes" in on the preceding line, you should realize that "inner class" in not being used as a synonym for "nested class".

    5. Re:Nice Comparison by Spy+Hunter · · Score: 1
      Are you saying that vectors have bounds checking? When was the last time you used a vector? Vectors are completely unsafe. If you make a mistake (like going off the end, or deleting/inserting an element in a vector that's being iterated over), you don't get nice compile-time or even nice run-time errors. You get big fat segfaults, or even worse, it gives you trash data and your program crashes a minute later doing something unrelated. That's my biggest problem with the C++ standard library. Sure, they've got some nice concepts in there, but you better not mess up or you're screwed. C++ doesn't need more ways to screw up, there are plenty of those already. What C++ needs is ways to *avoid* screwing up, and that's not what the standard library provides. (My second biggest problem with the standard library is that the way they do things is so damn "elegant," and the documentation is so full of jargon, you need a degree in CS and at least a year of stl coding experience to fully understand it. These things can be done in a way that's easier to understand.)

      What C++ really needs is a supplementary "standard library for dummies" which provides bounds-checked dynamic arrays, iterators that work (or at least fail gracefully) when the object changes, ways to make your objects garbage collected, and lots and lots of functions that are useful in practice, such as conversions from various number types to strings and vice versa. (I hate to praise anything related to MFC, but CString's AppendFormat function is brilliant.) Standard math objects with overloaded operators like complex numbers, 2D and 3D vectors, and matrices would be nice too. Oh, and more concise syntax for common things like declaring an iterator.

      --
      main(c,r){for(r=32;r;) printf(++c>31?c=!r--,"\n":c<r?" ":~c&r?" `":" #");}
    6. Re:Nice Comparison by Elladan · · Score: 1

      Apparently, the page was just edited today. That bit wasn't there earlier this morning.

      And furthermore... C has nested classes?

    7. Re:Nice Comparison by Anonymous+Brave+Guy · · Score: 1
      Are you saying that vectors have bounds checking?

      I imagine so, given that they do.

      Unfortunately, you have to use the at member rather than operator[] to get the checked version; the latter isn't required to be bounds checked. That is a very unfortunate (and well acknowledged) design error: the safer version should have been the default.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    8. Re:Nice Comparison by Spy+Hunter · · Score: 1
      Well, thanks for the STL tip. Unfortunately, I can find no reference to the at member in any documentation except MSDN's STL docs, which I tend to avoid. Did I mention that the available STL documentation sucks? It reads like a specification instead of a usage guide. While a specification is nice to have, a usage guide is what coders need, preferably with examples. GOOD documentation would note at the top of the page for vector that operator[] is not bounds checked, but at is. Anyway, yes, that is a HUGE GIANT design flaw. In addition, you can still iterate iterators past the end of their collections, no bounds checking there. Partial bounds checking that many (I'd say most) people are unaware of is almost as bad as no bounds checking at all.

      In closing, I hate the STL ;-)

      --
      main(c,r){for(r=32;r;) printf(++c>31?c=!r--,"\n":c<r?" ":~c&r?" `":" #");}
    9. Re:Nice Comparison by Per+Abrahamsen · · Score: 1

      Follow the links. Most of the yes, and some of the no are links to explanations. In particular, he is comparing languages, not compilers (which often compensate for shortcommings in the languages). And he is comparing with a freestanding C++ implementation, and argue why.

    10. Re:Nice Comparison by Anonymous Coward · · Score: 0

      Use the Debug version of the STL Port. All the bound checkings you can ask and even more. It's just an issue of the quality of the STL you use :)

    11. Re:Nice Comparison by Anonymous Coward · · Score: 0

      It was meant to compare the languages, not their standard libraries...

    12. Re:Nice Comparison by reapermane · · Score: 1

      So now we have to go and find a lib and configure that is not part of the language, just to get thing that are already part of the D language. With libs you can do anything. Infact there are many thing that could be taken out of C++ and put in a lib (floating point, for loops ect...). The reason they arn't is because it would be less useable/neat. D has taken some of the most common used parts of the C++ std and put them into a much more logical design as part of the language. Of couse Walter didn't put anything in D from the language that couldn't be improved by having language support. Try D for yourself and see what I mean. Try to come up with a library version that is as simply -> logical. You can't. In fact, you'll find that because of the inclusion of many of these thing, D has been able to reduce the size of C++.

    13. Re:Nice Comparison by Anonymous Coward · · Score: 0

      troll. u better learn c++

  143. Use a generic term or company name by tepples · · Score: 1

    I can't help you with COM, but Google easily finds Microsoft .NET and .NET framework.

    1. Re:Use a generic term or company name by Anonymous Coward · · Score: 0

      Why not "Digital Mar" D then?

  144. Use Python raw or triple-quoted strings by dmeranda · · Score: 1

    Python has a few ways to write strings which make working with regular expressions much easier...

    You can use """triple-quoted strings""", which can contain newlines and so forth.

    You can also use raw strings, with an 'r' prefix, as in r"a\backlash"...which turns off all \-style preprocessing. So that eliminates most cases where you have multiple-backslash explosion.

  145. Don't need to imagine -- it was the whole point by devphil · · Score: 4, Informative


    Stroustrup is on record many times over as saying that link compatibility with some existing language was a design criterion for him. If not C, then something else.

    It is an axiom in the C++ community that compatibility with C is both C++'s greatest strength and its greatest weakness.

    --
    You cannot apply a technological solution to a sociological problem. (Edwards' Law)
  146. I'm glad they kept operator overloading by AArmadillo · · Score: 2, Insightful
    Operator overloading is a huge syntactic blessing, and its abscence in Java is one of the reasons I hate using it. It takes a highly abnormal amount of kludge in a language without operator overloading to compare two objects. For example, in Java to compare of one array element is less than another:
    if(((Comparable) a.get(0)).compareTo((Comparable) a.get(1)) == -1)

    This is horribly ugly, especially when all I want to do is compare two integers for size. Casting, parenthesis everywhere, comparison with some arbitrarily chosen integer, etc. With operator overloading and templates, the same thing is possible in a much cleaner and more intuitive fashion:
    if(a[0] < a[1])
    It doesn't take any 'work' to understand what this code does. A ten year old kid could probably tell you that it involves 'less than'. This is also type-safe (I don't have to worry about if my objects actually inherit from Comparable).

    I like D. In my ideal world it would replace all uses of Java everywhere and anywhere, but unfortunately I doubt that will be the case.
  147. Lightweight C++ ?? by Anonymous Coward · · Score: 0

    It's pretty mature by now and can have all of D's features by tomorrow. Just ask for it! freshmeat.net:projects/lwc

  148. Gonna be /especially/ hard... by devphil · · Score: 1


    ...if it's true that D has removed "archaic" (*snort*) things like forward declarations.

    What, exactly, did they think a header file consists of?

    --
    You cannot apply a technological solution to a sociological problem. (Edwards' Law)
  149. The problem with C++ by Animats · · Score: 4, Informative
    D is Walter Bright's improvement on C++. Bright wrote the original Zortech C++ compiler, which was one of the first real C++ compilers, as opposed to a front-end for a C compiler. D is really too similar to the other C++ variants to get much traction.

    C++ itself is undergoing a revision. But the plans for it aren't that good.

    The big problem with the C++ committee is that most of the members don't want to admit the language has major problems. Neither does Strostrup, who has written that only minor corrections are needed. If that was really true, we wouldn't need all those variants on C++ (Java, D, C#, Objective-C, Managed C++, etc.)

    The committee is dominated by people who like doing cool things with templates. Most of the attention is focused on new features for extending the language via templates. It's possible to coerce the C++ template system into running programs at compile time (see Blitz). Painfully. LISP went down this dead end, where the language was taken over by people who wanted to extend the language with cool macros. (See the MIT Loop Macro.) We all know what happened to LISP.

    What isn't happening is any serious attempt to make C++ a safer language. C++ is the the only major language that provides abstraction without memory safety. That's why it causes so much trouble. C++ objects must be handled very carefully, or they break the memory model. This usually results in bad pointers or buffer overflows. Java, etc. are protected against that. This is the basic reason that writing C++ is hard.

    It's not fundamentally necessary to give up performance for memory safety. I've written a note on "strict mode" for C++, an attempt to deal with the problem. I'm proposing reference counts with compile-time optimization, rather than garbage collection. The model is close to that of Perl's runtime, which handles this well.

    Garbage collection doesn't really fit well to a language with destructors, because the destructors are called at more or less random times. Microsoft's Managed C++ does that, and the semantics of destructors are painful. With reference counts, destructor behavior is repeatable and predictable, so you can allocate resources (open files, windows) in constructors and have things work. The main problem with reference counts is overhead, but with compiler optimization support and a way to take a safe non-reference-counted pointer from a reference counted object, you can get the overhead way down and reference count updates out of almost all inner loops.

    C++ itself isn't that bad. The language could be fixed. But I don't see it happening. Microsoft has gone off in a different direction with C#. SGI, HP, DEC, Bell Labs, SCO, and Sun are defunct or in no position to drive standards any more.

    What C++ needs is some hardass in a position to slam a fist on the table and say "Fix it so our software doesn't crash all the time". It doesn't have one.

    1. Re:The problem with C++ by Alomex · · Score: 1

      The big problem with the C++ committee is that most of the members don't want to admit the language has major problems.

      People get emotionally invested in what they know to the point that they are often unwilling to see any flaws in their favourite tool.

      In this process a solid good product becomes --in the mind of the user-- perfect and as a result development stalls and the warts in the product continue to grow where minor surgery was all that was originally needed.

      Think about it.... how many revisions have there been, say, of C since its inception? How about Java? did they address cosmetic issues or substantive issues?

      Perl and Python are the only two examples that I know of where developers had the guts to question and revisit every assumption made in the past and come up with an improved language.

      Even D makes only incremental improvements. Is that all we have learned about C++ in the last twenty years?

    2. Re:The problem with C++ by Zobeid · · Score: 2, Informative

      You had a minor inaccuracy there. . . Objective C should not be listed as a "variant" on C++ or any kind of spinoff from it. It's a competitor. I'm not sure which one was invented first, but I remember clearly that both C++ and Objective C were introduced around the same time and both competed to be the widespread successor to C. C++ won that competition, though the reasons why are obscure to me. I rather like Objective C, and it's still the preferred language for application development on Mac OS X (that's a legacy from NeXT).

    3. Re:The problem with C++ by some+guy+I+know · · Score: 1
      C++ won that competition, though the reasons why are obscure to me.
      A couple of possible reasons:
      • C++ was created by a guy at AT&T/Bell Labs, where C was created.
        Objective C was created by NextStep (?) for their NeXT machine.
        So C++ had greater visibility.
      • The early C++ compilers translated C++ into C, and thus were more easily ported to other machines/systems.
        (I bought a C++ compiler that did this for my Amiga back around 1985 or so.)
        IFAICR, Objective C did not do this.
      --
      Those who sacrifice security to condemn liberty deserve to repeat history or something. - Benjamin Santayana
    4. Re:The problem with C++ by Animats · · Score: 1
      No, it's because C++, in the form of "cfront", was free.

      Bell Labs also created a language called "C+@", which was more dynamic, like Java. A small company called Unir Tech ended up with the rights and built a commercial semi-interpreted system in the early 1990s. Nobody knows about that because it was proprietary.

  150. Re:the most interesting part of that table by Anonymous Coward · · Score: 0

    Should've said ifloat/idouble, I guess? Would've made more sense...

  151. Where is the Objective-C comparison by Anonymous Coward · · Score: 0

    I looked at the article and the chart, I don't see the comparison to Objective-C as promised. All I found is that Docoa is in the works.

  152. write once, compile everywhere by Anonymous Coward · · Score: 0

    Honestly I like the idea, but wake me when it's ready for the enterprise.

  153. Re:actually, the more important reason for excepti by Anonymous Coward · · Score: 0

    Exceptions can be just as problematic as return type issues (what if your catch block doesn't catch the right thing?). The advantage you may have with throw/catch is that your brain has been trained to think about error handling in these terms (bear with me -- I'm not trying to troll...).

    Some view try/catch/throw and exceptions as nothing but syntactic sugar for setjmp/longjmp and a thread-local pointer. Delocalizing error handling requires almost the same amount of code with these calls, and after a bit of practice you'll find it no less intuitive to use a function call than to write try/catch/throw.

    With C you don't have to think about delocalized error handling if you don't want to; in a language that supports exceptions, you were likely taught the 'design pattern' as a language feature.

    I also find exceptions convenient, but I still dream of the day when everyone agrees how they should be thrown across library boundaries.

    Visit http://www.min.net/~gdinwiddie/programming/setjmp. htm for a quick read on setjmp/longjmp if you're interested.

  154. C++ not hard enough by Anonymous Coward · · Score: 0

    I program turing engines directly, with wet clay and a sharp stick. And I like it that way.

  155. - wetbacks - by blunte · · Score: 1

    I don't think that word means what you think it means...

    wetback

    If so, then it's completely lost on me.

    --
    .sigs are for post^Hers.
  156. I have to defend Java here by cdemon6 · · Score: 1

    AFAIK Java has JUnit for unit testing and an "instanceof" operator instead of "typeof". "Arrays of bits" can used without performance-loss with java's booleans because they are primitive types. Some other things look to me like obstacles, not features and the whole array stuff doesn't recognize that Java hast many types of Lists and Vectors which provide much more useful methods than arrays (and also son't really need a "foreach" operator).

    Those things are all marked red in the comparasion chart, so it looks like D is a clear winner. But please, let's look at how real code behaves in a real environment (security/performance/ease of use aspects).

    1. Re:I have to defend Java here by Anonymous Coward · · Score: 0

      instanceof and typeof are not the same thing. instanceof is done like shown here
      http://www.prowiki.org/wiki4d/wiki.cgi?HowTo /Realt imeTypeInformation

      The problem with having so many types of lists/vectors is that thing become un-standardies.

      security - I find that a real pain to deal with in java.

      performance - Java runs with a VM. Ok that can be resonably fast, but you can always write faster code in a language that could emulate a VM if VM's where really faster (which they are not).

      ease of use aspects - D is java++. You basicly have all of java plus more cool/useful things. Well D is not for web applications, that's well and truly java's field.

      You should give it a try and see for yourself.

  157. Re: C++'s biggest problem... by blunte · · Score: 1

    Is that it was cobbled together over years, and has thus become this giant, nasty monster.

    Having to carry two Meyers books
    - Effective C++
    - More Effective C++
    to avoid shooting yourself in the foot with C++ is a strong indication that something is wrong.

    Remember when automobiles had manual chokes?

    --
    .sigs are for post^Hers.
  158. u guys are funny by Anonymous Coward · · Score: 0

    1) If you say D is most programmers they will know what that means (100%?). If you said L, how many do you think will not know this. The fact that you had to explain this illustrates my point.

    2) D is not called D because its the next letter in the alphabet to C. D is D because its DigitalsMar's language.

    It's really funny this thread. Half you people haven't even tried D, so you don't know what your taking about.

    Anything you don't like about C++? Suggested it in the D forum and there just may be something done about it.

    C++ was not always the dominant language it is today. Why argue about popularity. Why not some critical thinking and ideas on the direction of languages for the 21st century.

    Boost and STL will also come out for D, but I'll bet they'll be half the size and much much neater and 99% of the time you won't have to use them.

    -My granddad refuses to get a microwave because he believes food cooked by it does not taste as good.

  159. C# 2.0 by eples · · Score: 1

    Interesting comparison chart - it may be worth noting that the C# Version 2.0 standard introduces both Function Literals and Templates as well as some other language goodies.

    I doubt it will ever allow inline assembler, though.

    --
    I'm a 2000 man.
    1. Re:C# 2.0 by Anonymous Coward · · Score: 0

      So does that prove that D has made a good choice in this area? I mean if D already has it, what else does it have over and above C#?

  160. Re:actually, the more important reason for excepti by Anonymous Coward · · Score: 0

    BS..

    exceptions are for all exceptional circumstances.. Errors are always exceptional, not part of the normal process flow.

    You're confusing this with using exceptions for decision making. If a action has two posible (non-error) outcomes should this be handled w/ an exception?? No.

    Java handles exceptions just fine thank you.. not forcing you to check return values. Java just copies Smalltalk on this.

    Java's idea of Try/Catch is to separate error handling from normal process flow..

    It is clear you don't know what you're talking about.

  161. For C compatability with safety and speed... by QuantumFTL · · Score: 1

    For C compatability with safety and speed, why not try Cyclone

    It's typesafe! No problems with null pointers, or out of bounds memory errors! Just say no to buffer over/underflows!

    Tired of garbage collection slowing you down? Use its regional memory management - no dangling pointers guaranteed! Safe library wrappings, for her pleasure.

    Need a little help with your "flow control"? You might check out its ML-baseed pattern matching. Shorter code, in less than 30 days, guaranteed!

    And forget enums, what you really want is tagged unions - typesafe, and makes some algorithms oh so short and sweet to write. Makes recursive data types a snap - great for ASTs!

    And of course there's parametric polymorphism, abstract structure types, and even subclassing of pointers! With all that done for you, you could even set up your own object system - just how you like it!

    Last but not least, there's some decent type inference - stop writing down the damn type of every last thing you give to the compiler, this compiler knows better :)

    Check out Cyclone today, it's sure to blow you away!

    Cheers,
    Justin

  162. Link by QuantumFTL · · Score: 1

    Heh, forgot to include a link to Cyclone.

    All kidding aside, I really don't see why more people aren't using a fast, safe, low-level real-time capable language like Cyclone instead of C for many things.
    Don't get me wrong, C is great for a certain set of specific things, but more often than not the power gets used in a suboptimal way (which wouldn't occur in a less expressive language).

    Cheers,
    Justin

  163. Amiga E by LentoMan · · Score: 2, Informative

    There is already a programming language called E for Amiga:
    http://wouter.fov120.com/e/

    1. Re:Amiga E by scrytch · · Score: 1

      > There is already a programming language called E for Amiga:

      E is also the name of a language for the Java VM:
      http://www.erights.org

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
  164. Garbage Collection by Anonymous Coward · · Score: 0

    Automatically makes this a "NOT-A-REPLACEMENT-FOR-C/C++". I dont care how good your garbage collection is, I'm not letting it near my driver or game or high speed application of any type. Garbage Collection is a crutch for people who dont know how to code. "It can link with C" - yea, well so can C. Why program in 2 languages and worry about the inter-language problems? If your going to use this, might as well use java or C# or any number of a million other similar technologies. Nothing new here, move along.

  165. TV-Quality Video by cutecub · · Score: 1
    Pause times below 1/10th of a second? Hmm, how much below? TV-quality video is 24 frames per second, so a one-tenth second pause means dropping two or three frames. Acceptable? Perhaps, but not desirable.
    Not to be too niggly, but if by "TV-quality video" you mean Broadcast NTSC, then its 60 fields per second. First the even and then the odd scanlines, ( or vice versa ) producing 30 full frames per second.

    So, your point about the undesireale effects of delays caused by Garbage Collection is even more relevent with regards to broadcast video.

    An example might be a celular handset with a software-defined radio receiver for pulling in local TV broadcasts. Without some sort of realtime extensions which allow you to defer garbage collection, Java's GC would cause frame dropouts. Not that you'd notice on a 2 inch screen...

  166. Yeah, that's the real problem by Anonymous Coward · · Score: 0

    All of the publicly available GC's SUCK, for the most part. Especially the java plugin for running applets. I get 1 second pauses ALL the time with that steaming pile.

    Writing GCs is hard, and by the time you're through, it's no wonder that most GC writers want some sort of compensation for their efforts. Which means it's going to be a looooong while before we see a good public open source GC.

    Meanwhile, developers get to base their opinions on the GCs that are currently out there, and by the time a good one rolls around, nobody will care.

    Personally, I think you should have the option whether or not to use a GC with a language - it should have the hooks for GC, but if you know what you're doing, you should be able to raise the training wheels, and go.

    1. Re:Yeah, that's the real problem by be-fan · · Score: 1

      Don't compare GC to training wheels. Manual memory management makes some very advanced programming techniques nearly impossible. No sane programmer would want to manually manage the memory of a closure or continuation!

      And there are a number of publically available GCs that are very good. Intel's ORP has a very advanced garbage collector. OCaml has a very good incremental generational collector. The MPS is a very advanced memory manager, with an incremental generational GC among other things.

      --
      A deep unwavering belief is a sure sign you're missing something...
  167. whoopti-do by ryen · · Score: 1

    it looks like they've merely added features to the core language that have already been developed as libraries in java, C++, C#, etc..

    'D' just looks bloated now.

    1. Re:whoopti-do by Anonymous Coward · · Score: 0

      All the *extra* features added to D are things that are commanly used all the time in programming (arrays, contracts) and you should find them much more user-friendly then library methods. Some things just come out so much nicer as part of the language then in libraries.

      Consider STL's foreach (won't use the one from algorithms because that's worse)

      #include ...
      std::vector vec;
      std::vector::iterator iter;
      for (iter = vec.begin(); iter != vec.end(); ++vec)
      { ...
      }

      Now D:

      int [] vec;
      foreach (int iter; vec)
      { ...
      }

      Plus you can overload opApply for a class/struct and don't need to change the rest of the syntax at all (like you would have if you switched from arrays to vectors in C++ -> well there is a work around but why have arrays in core C++ at all then?).

      oArray vec; //opApply overload for oArray
      foreach (int iter; vec)
      { ...
      }

      Have you ever tried using D? Even looked at the website. You will find that D is less bloated then C++ or C# (and I don't believe the core language of java is *bloated* enough -> yet).

      I mean how may opperator overloads does C++ have? How difficult is it to write a fully compilient C++ compiler? How many different ways are there to write the same thing?

      D is much easier if you would care to give it a shot (with an open-mind). See how much faster you can develop in D.

  168. C++, D, Java are out... by feloneous+cat · · Score: 1

    ...when you are working with the small machines.

    C works quite well for the majority of processors out there - no, not 80x86, but 8051/8052 and 68xx's. You know, the REAL embedded systems.

    These processors couldn't work with D or C++ (although I am game to try). C# [laughs] - yeah, pull the other one.

    These guys are thinking sooooo IN the box....

    Feloneous

    --
    IANAL, but I've seen actors play them on TV
  169. Situational Languages by jtpalinmajere · · Score: 1

    D to me just seems like a language that rehashes a language that doesn't really need to be rehashed. Not that that's a bad thing necessarily, I'm always in favor of innovation. However, I don't see it making much of a difference unless it can make a particularly BIG splash in the sea of languages that already exist. There's also a factor of familiarity of languages and/or their use in certain situations.

    I for one generally program in one of three different situations. On the one hand, I deal with programming low level drivers and/or real-time systems and programming high performance engines (whether networking, graphics, or sound oriented)and so I use C for the obvious reasons of speed and low level control. On the other hand, I also involve myself in programming GUI based business apps and web services and so I also use C# for its relatively rapid devel time. On yet another hand (didn't know I had 3......), I use Perl when i'm feeling like doing some system administration scripting or web interface scripting.

    Even if D (or some other further iteration) becomes the absolute best language to do everything in (which I doubt) I still have my three languages that do everything I really need to do (with the occasional offshoot into LISP for personal AI projects).

    1. Re:Situational Languages by reapermane · · Score: 1

      People were slow to adopt C++ at first. There were plenty of critisms like this one. The trouble is people don't want to learn new things. They just like to stick with what works for them. D is not a one-shoe-fits-all language. You should pick which language is best for the task. Once you know D's positive attributes, you'll know what it's good for.

  170. Re:actually, the more important reason for excepti by naoursla · · Score: 1

    That is why Java has a "finally" catch block. Code in it is run when the try block is exited for any reason -- including an exception being thrown that is caught higher up in the stack.

  171. Going down the chart point by point... by Chuck+Messenger · · Score: 2, Informative
    OK, I delved into D a bit more. It does look like a very interesting language, now that it has templates. Some comments, going down the cart (considering D in relation to C++):

    Function literals This is excellent. Function literals would make C++ a much better language. The STL cries out for them. While Java doesn't have function literals, it has something pretty close -- anonymous nested classes. But C++ has nothing very close. The best you can do is something like the Boost lamba library, which while impressive, it quite horrible. This feature makes D pretty interesting to me.

    I'd be interested to know what D has in terms of standard libraries -- something akin to the STL..?

    Dynamic closures Not sure exactly what this is, but I imagine it makes D into a fully-functional language. Sounds great! It makes me even more interested.

    Resizeable arrays Well, I don't think this claim stands up -- that C++ doesn't have resizeable arrays. After all, since D is a garbage-collected language, I'm guessing its arrays are on the heap, not the stack. C++ has resizeable heap arrays -- vector, etc.

    Arrays of bits Again, I take issue with C++ not having these. Check out Boost::dynamic_bitset.

    Built-in strings Once again -- no way. C++ certainly has built-in strings, in any meaningful sense of the word -- std::string.

    Array slicing I'd be intersted to see an example of how D's array slicing compares to C++'s interator-based programming. I'm not sure what's being talked about here, exactly.

    Array bounds checking There's really no meaningful way you can say C++ doesn't have array bounds checking. Come on! What C++ has, which might be much better than D, is switchable array bounds checking. You don't _have_ to check array bounds (e.g. for release builds), but it's trivial to add if you want it.

    Associative arrays Wrong! C++ certainly has associative arrays. They're quite excellent. See std::map and std::multimap. And of course, you can build any special sort of associative array you want -- say, a hash.

    This chart is completely biased against C++ -- quite unrealistic. Why not just stick to the _real_ benefits D has over C++, and not kick up alot of FUD? It only serves to make people like me (rightfully) skeptical.

    Strong typedefs OK, fine -- typedefs aren't strong in C++. But if you want something to be strong, make it a class/struct/enum. Why do typedef's need to be strong? What's really being said here is that D lacks a "type alias", which is what a C++ typedef is -- just a shorthand for another type. Does D have that?

    String switches Just syntactic sugar, although I admit it might be nice syntactic sugar.

    Multiple Inheritance An unfortunate deficiency of D. I find multiple inheritance to be quite useful. But D can't have everything -- that's OK. If this were D's only deficiency, it wouldn't be fatal to me, especially because...

    Interfaces ... interfaces get you _most_ of what's good about multiple inheritance. But not all.

    Dynamic class loading This is a nice thing about Java. Too bad D doesn't have it (but hardly a fatal problem, for me).

    Inner classes Seems like D's functional programming capabilities trump the lack of inner classes...

    Covariant return types Ummm -- what are these? C++ has them, so I must know what they are....

    Properties Syntactic sugar...?

    Inline assembler
    Direct access to hardware
    Direct native code gen Excellent. However, one reason I really like C++ is that there are toolchains for a huge variety of hardware. If there were a gcc front-end for D, that would go a long way to addressing this issue...

    Lightweight objects Meaning, stack-allocated objects?

    Explicit memory allocation control Does this mean D has _real_ destructors (unlike Java's pseudo-d

    1. Re:Going down the chart point by point... by fgb · · Score: 1

      No, C++ most certainly does not have: resizeable arrays, arrays of bits, built-in strings, array bounds checking, associative arrays, complex and imaginary numbers.

      That's why the STL and other libraries were created: because these features do not exist the language itself.

    2. Re:Going down the chart point by point... by Chuck+Messenger · · Score: 1

      But the STL _is_ C++. It's not like the STL is this library hanging off of C++. It's considered to be an integral part of the language. Compiler writers are free to do optimizations based on the known behavior of the STL.

      Hence, in all meaningful ways, C++ has the above-mentioned things. It's just pedantic to argue otherwise.

      On the other hand, C does _not_ have them, in any meaningful sense (yes, you can write libraries which implement those things, but that's not the same as being part of the language, fully supported by the language's syntax).

    3. Re:Going down the chart point by point... by jareds · · Score: 1

      Strong typedefs ... What's really being said here is that D lacks a "type alias", which is what a C++ typedef is -- just a shorthand for another type. Does D have that?

      Er, yes. It's listed 2 lines after strong typedefs.

      If there were a gcc front-end for D, that would go a long way to addressing this issue...

      One exists, but note the huge caveat at the top of the page about the runtime library. Because it has to handle GC, I guess?

    4. Re:Going down the chart point by point... by voodoo1man · · Score: 1
      Not sure exactly what this is, but I imagine it makes D into a fully-functional language. Sounds great! It makes me even more interested.
      It's an anonymous function that "captures" the bindings of whatever variables it needs in the lexical scope it is created in. Not really functional (closures are all about the state of those variables), but they're handy as a light-weight, high-performance alternative to objects. I don't know why he calls them "dynamic" closures, since D doesn't have dynamic scoping, and "lexical closures" has been used to mean the same thing for about 20 years now. Same thing with "function literals" vs. "anonymous functions."
      I'd be intersted to see an example of how D's array slicing compares to C++'s interator-based programming. I'm not sure what's being talked about here, exactly.
      Array slicing (displaced arrays) is an awesome abstraction for efficient, in-place array manipulation. For example, you can do in-place bit-blit with 2d displaced arrays. Unfortunately, the D specification leaves out any mention of multidimensional arrays - looks like you can only displace to vectors. All the modern languages I've come across that do this are crippled in the same way. Zetalisp let you do real nifty stuff, like multidimensional displaced arrays, and displacement to different types - so for example you could access an array of words as an array of bytes (or bits!) very efficiently.
      There's really no meaningful way you can say C++ doesn't have array bounds checking. Come on! What C++ has, which might be much better than D, is switchable array bounds checking. You don't _have_ to check array bounds (e.g. for release builds), but it's trivial to add if you want it.
      Array bounds checking should always be there unless it is a performance problem. Constructs like iterators in C++ and foreach in D allow bounds checking (and some other stuff) to be optimized out (not to mention providing a base for vector/parallel code generation that is a whole lot less brain damaged than the for loop analysis the current C vector-targeting compilers have to do). For D, this is also a really good idea since strings are arrays.
      Conditional compilation At least this gives you some of the power of a preprocessor. But why stop there? Why not have _all_ the power. While you at it, make a cool preprocessor, like O'Caml's, or Lisp's.
      The O'Caml preprocessor (Camlp4) is very neat (from what I understand, you can adapt it for source-to-source transformations for pretty much any syntax with a context-free grammar - this could be a starting point for a hypothetical D preprocessor). (Common) Lisp doesn't have a pre-processor (aside from reader-macros so you can write 'foo instead of (quote foo)) - you really can't get anything similar in D (or O'Caml) until you have run-time code generation and loading, a uniform representation for program source code, and a large amount of introspection facilities.
      --

      In the great CONS chain of life, you can either be the CAR or be in the CDR.

    5. Re:Going down the chart point by point... by Anonymous Coward · · Score: 1, Interesting

      You have to remember that this table was done without STL in mind as STL is not built-in and can easily be replaced with something else. So while you may critise the author for not including the STL and boost libraries, it is not wrong.

      I'll just go through a couple of these things:

      Bound checking
      How many extra lines of code would you need to add this? D does not check array bounds on release builds.

      Preproccessor
      If you really must, you can still use c's preproccessor, it's very easy to use individually.
      So you say enabling bound-checking is easy, but enabling the C-prepoccessor is hard (one line)?

      D solves most of the hacks and work-arounds you need to use macros for in C++. Why not post a case to the D newsgroup that you think can't be solved without macros?

      The problem with C++ strings is that there are so many different types.

      Complex and Imaginary
      Your probably right here, but how primative do you go? Floating point doesn't nessarily need to be built into a language either (don't argue performace because Complex and Imaginary types can get a large performce boost by being optimised by the compiler).

      Conditional compilation now whos trying to bloat the language?

      I guess we all have different ideas on what makes a perfect language. You can never write a language that everyone is 100% happy with.

    6. Re:Going down the chart point by point... by stripes · · Score: 1

      I agree with a lot you say, so I'm only including the stuff I disagree with.

      Arrays of bits Again, I take issue with C++ not having these. Check out Boost::dynamic_bitset

      I accept the argument that STL things should be thought of as "part of C++", but I'm not sure boost should be thought of as "part of C++"...if you do, what external non-standard libraries do you exclude?

      Array bounds checking There's really no meaningful way you can say C++ doesn't have array bounds checking. Come on! What C++ has, which might be much better than D, is switchable array bounds checking. You don't _have_ to check array bounds (e.g. for release builds), but it's trivial to add if you want it.

      It does? I know there are some drop in STL replacements that do this (not for the base array type, but for vectors and other STL template types), but that isn't exactly standard. Vector has the at method, but that isn't switchable.

      FYI, D's bounds checks can be switched off.

      Lightweight objects Meaning, stack-allocated objects?

      I think so, auto objects have the same lifetime as stack objects in C++ so there is nothing stopping them from being allocated on the stack. I don't know if they really are though.

      Explicit memory allocation control Does this mean D has _real_ destructors (unlike Java's pseudo-destructors -- "destruct this object eventually, when you get around to it")

      The destructors for auto objects fire when you would expect them to. The destructors will also fire if you explicitly call delete. If you do neither of those the GC will do it's thing and the destructor will be called "sometime". So as far as determinism goes it isn't as good as using boost::shared_ptr for everything, but it isn't as bad as Java because you can make it happen without going too far out of your way. You might even be able to port auto_ptr to D.

      Constraints Sounds interesting, but I can't tell what they are. Are they more than just syntactic sugar?

      Not really. Well, kind of. Constraints and the Design by contract stuff can all be done in C/C++ with assert and a few tricks. What D can do is still allow the compile to make assumptions based on the constraints/DbC stuff when you have them "disabled for a release build" (not that I'm convinced it is good to disable asserts for release, but that is a side issue). Also this is the kind of thing where syntactic sugar and language conventions is important anyway.

      RAII ? Why not spell out the acronym? "Runtime something something initialization...?"

      It is a C++ idiom (and term!). "Resource Acquisition Is Initialtion". In other words you get all your resources by having an object's constructor allocate them, and you release them via object destructors. That way if you ignore exceptions you get proper cleanup anyway (and you also get proper clean up across multiple exit paths). Stack objects in C++ and auto objects in D are a big help here, as are C++ auto_ptr and their more powerful and safer (but slightly slower) brother boost::shared_ptr

      Macro text preprocessor

      I'm on the fence on that one. Nested functions and templates and conditional complation take over a whole lot of the slack here, but there are still a few things I use macros for (mostly having to do with __LINE__ and __FUNCTION__ and errors and control flow) in C/C++.

    7. Re:Going down the chart point by point... by Chuck+Messenger · · Score: 1
      I accept the argument that STL things should be thought of as "part of C++", but I'm not sure boost should be thought of as "part of C++"...if you do, what external non-standard libraries do you exclude?

      Right -- Boost isn't part of C++. On the other hand, at least in my mind, it's a sort of quasi-standard. It's (usually) well-designed, up to generally-acknowledged C++ best practices (being a peer-reviewed library). It has a permissive license. It's available on a wide range of platforms. It's well documented. Hence, my argument goes like this: if D has feature X, which C++ doesn't have built-in, but which is available in "native-alike" form in a Boost library (that is, if its Boost implementation is so nicely done that it "feels" like it's as good as a built-in C++ feature), then I don't think D has much, if anything, to boast about (on that particular score).

      Indeed, to me, it's an indication of a well-designed language if it doesn't _need_ alot of built-in stuff -- the user is able to build their own primitives, in effect. That's power, to me. Especially when you combine that inherent language facility with a mature, broad, widely-used quasi-standard library like Boost.

      About array-bounds checking:

      It does? I know there are some drop in STL replacements that do this

      Exactly what I was referring to. See above reasoning about the Boost library. So, if you're using a well-designed C++ implementation, then it's trivial to have runtime bounds checking in debug mode. True, it isn't built into the language. But I don't care too much about defining what's built-in vs. what isn't. The question is, what is the user experience with a not-too-badly-implemented version of C++? I would argue that in the end, that's all that really matters. I'm not saying the standards documents don't matter -- they do. But what matters more is this: what is the modern, best-practices C++ programming experience like today, vs. D?

      Since D is brand-new, I'm guessing there's only one implementation. Hence, whatever's in that D implementation is "part of the D standard". D has it easy that way. C++ has a huge history, with several high-quality and independant implementations. Over time, best practices emerge from the gigantic C++ community, and eventually (hopefully) the best things find their way into the standard. So we should be comparing D best practices to C++ best practices, rather than comparing the D standard (which can change like the wind, and has -- e.g. the addition of templates) to the C++ standard (which takes years to turn over a cycle). Of course, that inertia is a C++ weakness. D has the potential to leapfrog C++ due to this factor. That's what excites me about D.

      Thanks for filling me in on some of those D features I had questions on.

      "Resource Acquisition Is Initialtion"
      Oh, riiiight -- I'd forgotten that one, deep in the mists of time. OK, so D has this, and C++ has this, but not Java. RAII must mean the "deterministic constructor/destructor" paradigm, referred to earlier (i.e. you control exactly when destructors fire).

      As for macros: I find lots of uses for them, besides just conditional compilation (at syntactically-awkward moments). My only regret is that they aren't much more powerful in C++. The ideal would be something akin to Lisp -- where the macros generate code at runtime. OK, maybe too much to swallow for a "traditional" language like D (although I don't see why, necessarily...) But O'Caml's macros are quite nice. There's much that can be done with macros, in terms of making code less tedious. For example, look at just about any windowing API (e.g. wxWindows, aka wxWidgets). The fewer the number of keystrokes required to implement a piece of code, the better (given that clarity, etc., is maintained).

      Anyway, I'm curious -- you sound like you know alot about D. Have you tried developing with it? I'd be interested to hear what you think of it, as it compares to whatever else you use. I'm tempted to delve into it -- try it out.

    8. Re:Going down the chart point by point... by stripes · · Score: 1

      Right -- Boost isn't part of C++. On the other hand, at least in my mind, it's a sort of quasi-standard. It's (usually) well-designed, up to generally-acknowledged C++ best practices (being a peer-reviewed library). It has a permissive license. It's available on a wide range of platforms. It's well documented. Hence, my argument goes like this: if D has feature X, which C++ doesn't have built-in, but which is available in "native-alike" form in a Boost library (that is, if its Boost implementation is so nicely done that it "feels" like it's as good as a built-in C++ feature), then I don't think D has much, if anything, to boast about (on that particular score).

      Except that many many many C++ programmers use C++ without the benefit of boost. Not all of boost is as well debugged as libstdc++, and despite best intentions not even a significant fraction of the boost lib is going to be in the next standard C++ lib (SPRIT won't be for example). Also C++ compilers are free to conspire with the standard C++ lib to operate faster by knowing more then can be determined by looking at the source code. They can not do so with boost.

      Indeed, to me, it's an indication of a well-designed language if it doesn't _need_ alot of built-in stuff -- the user is able to build their own primitives, in effect. That's power, to me. Especially when you combine that inherent language facility with a mature, broad, widely-used quasi-standard library like Boost.

      Yes. Agreed. I would rather have a language that has ref counting smart pointers in a library then built-in and impossable to user define because it means someone can implement smart pointers that point to stuff in a persistent storage pool, or smart pointers that do some other odd thing. Language support for user defining complex numbers can also be used to define other types of numeric data types (numbers in modulo space, bignums, rational numbers) while merely having built in support for complex isn't nearly as useful.

      On the flip side having the language be extensible enough to implement things like complex numbers, but also just plain defining them in the language for notional connivence isn't bad.

      Exactly what I was referring to. See above reasoning about the Boost library. So, if you're using a well-designed C++ implementation, then it's trivial to have runtime bounds checking in debug mode. True, it isn't built into the language. But I don't care too much about defining what's built-in vs. what isn't. The question is, what is the user experience with a not-too-badly-implemented version of C++?

      You don't get runtime checking on char buf[1024] though. You also have problems where a already compiled C++ lib that you want to use was compiled against the normal C++ stdlib so your debug STL iterators can't be passed in (then again most C++ libs come with source -- commercial or not)

      There may be important platforms have a C++ compiler, but don't allow you to redefine things in std::. That might end up being some embedded platform you need to use some day, which would suck. (ok, so D is unlikely to run on that platform, and if it does gcc does, which other then speed issues and a poor debugger isn't a bad C++ platform).

      Plus like boost, lots of C++ programers don't use SafeSTL (I don't know if it is due to fear, ignorance, running on unsupported platforms, short term laziness, or what).

      Since D is brand-new, I'm guessing there's only one implementation

      Two. The one to guy who orignally wrote the zortech C++ compiler wrote (which is as far as I know the D reference platform) and a gcc based one that works for most but not all D programs (I think it has template issues similar to the old C++ "where is the template" issues - because I think it compiles the source one file at a time rather then all at once)

    9. Re:Going down the chart point by point... by Chuck+Messenger · · Score: 1

      On the flip side having the language be extensible enough to implement things like complex numbers, but also just plain defining them in the language for notional connivence isn't bad.

      Yes -- I think you've got it right. You want a language which _lets_ you define all your own primitives, but also a language which supplies you with a decent standard set. The STL is nice that way: templates _let_ you make all your own containers, like arrays, but at the same time, you're supplied with a standard set. Having the standard set isn't just a convenience (which it is, and that's important in its own right). It also means that you can quickly understand other peoples' code. And it also means there's likely to be alot of useful documentation (including not only the regular documentation, but also books, newsgroup postings, etc).

      So, the fact that D's arrays are built in to the language is of relatively little importance. Just as good are C++'s standard vector, etc. It doesn't hurt C++ much (if at all) that vector isn't "built in" to the language. It is, really, in every important sense. Same goes for string, etc. All because C++ has _standard_ versions of these (in addition to having the language facilities to create your own versions, if you like).

      You don't get runtime checking on char buf[1024] though

      Sure -- but if you want safeness, use vector(1024) instead. I know, there's no static initialization of vector. But I tend to use arrays in a specialized way -- only for their static initialization properties. I agree it's a hole in the language, though. D might allow stack-allocated arrays with bounds checking. If so, it has something on C++. Also, D would have something on C++ if its arrays could be statically initialized. I assume they can be...?

      You also have problems where a already compiled C++ lib that you want to use was compiled against the normal C++ stdlib so your debug STL iterators can't be passed in (then again most C++ libs come with source -- commercial or not)

      Yeah, not having source sucks! I don't mess with things unless I have the source (which is why I use Linux!)

      Two. The one to guy who orignally wrote the zortech C++ compiler wrote (which is as far as I know the D reference platform) and a gcc based one...

      OK -- that answers one of my questions -- there _is_ a gcc implementation. But not a standard one.

      On the other hand we have the argument that "anyone using D, even a first time novice will get GC and bounds checking and libraries with DbC and so on while those same people using C++ will get the poorly designed rotocraft-hellicopter-chansaw-stuffed-into-a-1972- VW-bug that slices their arm off every third time they attempt a left turn without a turn signal, or every sixth time they attempt a right turn with a turn signal".

      Well said! Yes -- C++ is a dangerous language. You need to understand it thoroughly. If you do, it's the best thing out there (IMHO, etc). If you don't, use something simpler and safer, like Java, or Visual Basic (now I'm just getting downright _mean_!)

      O'Caml is a language I haven't learned.

      O'Caml's claim to fame is that it's the "working man's" functional programming language -- a practical functional programming language. There's also Haskell, which is more loved among academics, and ML, which is the original of the ilk. They're a great family of languages! But they lack templates, which makes them not so interesting to me. The reason I'm excited about D is that it appears to be pretty much "functional C++" -- nirvana!

      Er, not yet. It has bumped Ruby down to 3rd on the list to try. It hasn't displaced Objective C yet (I have this nifty PowerBook and haven't done more then the Currency Converter tutorial). In fact if it wasn't for all the GUI

  172. Against the grain... by mattgreen · · Score: 2, Interesting

    In the midst of the, "it's not C it sucks," and "it has a GC only real programmers manage memory," and other bullshit arguments you're just ignoring what is generally a much needed cleanup of C++ that isn't terribly more complicated than the original C. I'm not saying you have to like it, but everyone seems to have read the tag line and not actually gone to the site. Walter is very thorough about why he made the choices he did. The only real point I've seen in all the posts was that it needs dynamic class loading, and I've wanted introspection to at least be an option. Also, I disagree with the syntax he used for templates, but that is a minor issue.

    With C#'s generics being somewhat gimped and users working on a functional library for D that is similar to STL but easier to use, D is really shaping up nicely as a future development platform and a bleeding-edge language, kind of like what C++ is today with template metaprogramming. I tend to gravitate towards the looser, more esoteric languages like Perl and C++ because of the steep learning curve -- who doesn't enjoy a challenge?

    So don't bitch about how it sucks because it isn't C. It's amazing C is still kicking.

  173. no multiple inheritance :-( by DuckWing · · Score: 1

    The lack of MI is a big negative for me. I'm actually surprised Java doesn't have it. Oh wait, that's one reason why Java SUCKS! :-)

    --
    -- DuckWing
  174. Re:#include by ckaminski · · Score: 1

    #define WIN32_LEAN_AND_MEAN
    #include <windows.h>

    You'll dump a lot of the GDI and OLE stuff.

  175. " ... the most important thing by baudolino · · Score: 3, Funny

    in the programming language is the name. A language will not succeed without a good name. I have recently invented a very good name and now I am looking for a suitable language." -- D. E. Knuth, 1967

  176. Amen, brother by Anonymous Coward · · Score: 0

    I was hoping for someone to get a clue and actually name it P instead of some C whatever or even worse, D...

  177. Where's Objective C? Not on the table... by Anonymous Coward · · Score: 0

    The table has C, C plus plus, C sharp and Java. Unless Objective C is now C#, which used to be C sharp. I don't see it.

  178. MOD PARENT DOWN - SILLY ANALOGY :) by zarr · · Score: 1

    If I'm a troll, why do you feed me? :)

    Seriously: Somethimes the "unnecessary" layers are what makes productive software development possible. It's called abstraction.

  179. delete object; by WalterBright · · Score: 1

    D has this. One can specifically delete a GC-allocated object, and the GC will delete it immediately without running a collection pass.

    1. Re:delete object; by stripes · · Score: 1
      One can specifically delete a GC-allocated object, and the GC will delete it immediately without running a collection pass.

      Cool! Do any stray pointers to it just dangle, or does something null them out? Are references through them caught, or a quiet error?

      If the GC finds the pointers later does it throw an error, ignore it, or end up doing something wrong?

    2. Re:delete object; by WalterBright · · Score: 1
      Do any stray pointers to it just dangle, or does something null them out? Are references through them caught, or a quiet error?

      There's no way to detect dangling pointers if you explicitly delete a gc'd object. So, be sure there aren't any if you're using delete explicitly, just as if you were doing free() in C.


      If the GC finds the pointers later does it throw an error, ignore it, or end up doing something wrong?

      Ignore it.

  180. D does have templates by WalterBright · · Score: 1

    see templates

  181. no reflection/introspection by ndunn · · Score: 1

    There initial list of features are nice, but dynamic loading, and shaky introspection are the two big things that really frustrate me about the C++ base. I would assume this was for reasons of efficiency, but I see no mention of this on their link.

    1. Re:no reflection/introspection by Anonymous Coward · · Score: 0

      http://www.prowiki.org/wiki4d/wiki.cgi?HowTo/Realt imeTypeInformation

  182. C++ did not pioneer generic programming by Tired+and+Emotional · · Score: 1
    The first major language to provide generics was Ada. These were added to C++ much later.

    Ada (95, not the original) also has first class polymorphism, which C++ does not (unless you fake it with smalloc, and a smart pointer)

    --
    Squirrel!
    1. Re:C++ did not pioneer generic programming by Anonymous Coward · · Score: 0

      D takes many ideas from ada. So taking ideas from other languages is a bad thing? D takes ideas from many different languages.

  183. GNU version of D by WalterBright · · Score: 1

    David Friedman has integrated the D frontend with GCC.

  184. Re: Fads by Anonymous Coward · · Score: 0

    "I sat out PL/1"...

    and missed a language that was a thousand times better than its competition at the time (lousy Fortran and lousy Cobol).

    I don't use PL/I (the correct way to print it, BTW, even though it was pronounced "one") anymore, but I got valuable background training on pointers, decent loop-control structures, linked lists, etc., that came in handy when C came along years later.

  185. where's my check? by WalterBright · · Score: 1

    Its all a conspiracy by computer manufacturers. If that's true, they haven't let me in on the conspiracy, and none of them have offered me any money to make D slow :-)

  186. Re:Nice Comparison... actually yes, it is by FlyerFanNC · · Score: 1

    How did this get modded "interesting"? It sounds like a rant from a nine-year-old who doesn't know how to act like an adult and treat people with respect. And anyway, it misses the whole point of the language.

    True, the C++ STL has several of the features which are labeled "No" in the comparison. But it appears that one of the design objectives of D is to put features like arrays into the core of the language, rather that relying on some library. Perhaps the comparison should have said "first class associative arrays" or "core language support for..." or such. It *did* actually say "built-in strings," which hints at the intent of the comparison.

    Elladan: Grow up and learn some manners.
    Moderators: Read some more details about the posts or skip them.

  187. You better back it up! by Chemisor · · Score: 1

    > a high incidence of memory management related
    > problems, which are often very hard to find

    If you use STL or some other MM encapsulation classes, you will have NO memory management related problems. Ever. This is quite unlike C code, where you really do have to remember to free the mallocs. In C++ you never allocate any memory at all. Only newbies do it before they either learn STL or write their own.

    > common security issues, often involving buffer overflows

    Buffer overflows are not solved by making another programming language. They are solved by fixing your algorithms. They are solved by ditching hand coded text parsers or, better yet, ditching text files of all kinds altogether. Use a packaged XML library to parse your input (you do have all your config files in XML, don't you?) and use libreadline or something for the shell. If you keep reinventing the wheel, don't whine about it breaking.

    > compiler incompatibilities, including frequent
    > lack of proper template support, exception
    > handling, namespaces

    That's why you use gcc for everything. gcc supports all those things you mention and is available on every platform worth mentioning. Don't blame the language when your vendor insists on locking you into their lousy compiler.

    > obscure and often terribly non-intuitive syntax

    Bullshit. C++ makes for a beautiful syntax. You just have no taste! ;) Seriously, a good C++ programmer can create interfaces that would make you drool. And as for newbies, well, they can write ugly code in any language.

    > overly complex and redundant idioms necessary to
    > work around language shortcomings

    C++ has no shortcomings. What are you talking about? :) As for idioms, all the other languages have them too.

    > they just switch to a more productive
    > language...like the majority of the software
    > industry is doing.

    No they are not. The majority of the software industry are concerned with developing web applications. You can't do that in C++ because you do not want the stupid user to install anything but a browser. C++ is for real applications that run on your machine, like an application is supposed to.

    1. Re:You better back it up! by Anonymous+Brave+Guy · · Score: 1
      The majority of the software industry are concerned with developing web applications.

      FWIW, I very much doubt that.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  188. Here's one by sacrilicious · · Score: 3, Funny
    I'd like them to come up with a better name [than "D"]

    How about "Double-D"? *That* will bring out the programmers in hordes.

    --
    - First they ignore you, then they laugh at you, then ???, then profit.
    1. Re:Here's one by AnalogFile · · Score: 1

      AFAIK that's already the name of a registered trademark (owned by Dolby).

    2. Re:Here's one by aztracker1 · · Score: 1

      I think D- would be cooler.. :)
      (finally, a language for sub-par developers.)

      --
      Michael J. Ryan - tracker1.info
  189. GDC by Klanglor · · Score: 1

    hummm so did anyone started to write the Gnu D Compiler?

    1. Re:GDC by jcc7 · · Score: 1

      There is a D front end for GCC (I've heard it's pretty good). Visit the d.gnu newsgroup (http://www.digitalmars.com/drn-bin/wwwnews?D.gnu) for more info.

  190. Re:actually, the more important reason for excepti by Chemisor · · Score: 1

    > You might catch an exception and but not have the faintest idea who threw it.

    That's correct. It does not matter one bit who threw the exception; the only things that matter are one: there was an exception, and two: the problem that caused it. The exception should name the problem, not the thrower. You do not have to handle every exception, and neither should you try to. All you should do is clean up and report the error (which you can easily do if you design your exceptions with an appropriate interface). If you don't need to cleanup, which would be true for almost all functions, you don't need try/catch blocks either. And don't blame exceptions for the bad design of COM interfaces either.

  191. What are the disadvantages? by Chemisor · · Score: 1

    > I don't think you understand the disadvantages of multiple inheritance.

    You are entirely correct. I do not. Perhaps you would like to enlighten me? I have many classes using MI and I find the result very clean and simple.

    1. Re:What are the disadvantages? by bradkittenbrink · · Score: 1

      Now that I am forced to articulate these disadvantages, I realize that they aren't as much problems with MI, as they are with c++'s implementation of MI. In c++ it is all too easy to use MI incorrectly and screw things up with improper casting. When used properly, it is certainly a very powerful language feature, and if you have used it without problems then you work with a more educated programming staff than I.

      The other main disadvantage I've heard of is that it is a particularly difficult feature for compiler writers to implement. Although I've never written a compiler and don't intend to, I certainly think this is an important factor in language design. Simpler compilers means less buggy compilers with greater cross-vendor compatibility.

      If you have working code that uses MI, then I think that's great, don't throw it away by any means. I just think it's a good idea to think twice about including it in new languages when there are other language constructs that can do just as good without some of the problems.

  192. You mean Db? by Anonymous Coward · · Score: 0

    Don't you mean Db? They already came out with that.

  193. Re:Nice Comparison... actually yes, it is by Urkki · · Score: 1

    Well, the revealing thing about is, that it does include *some* STL features in the comparison chart, such as strings and vectors, but fails to recognize for example map. This reveals fundamental lack of knowledge about C++ and STL by the writer of the comparison, and justifies quite a bit of BZZZTing...

    After all there's not much difference between putting stuff at the core and putting it into a standard library, really. Mostly putting stuff to core may allow cleaner syntax, while putting it to the library may allow more flexibility.

  194. Re:try, catch, finally (return values) by jareds · · Score: 1

    NULL is often (void *)0, which is *technically* valid on some architectures (OS notwithstanding). It's just so unlikely a result that it's safe to use.

    NO!!!! (void *)0 is not the address of anything (that the C program can use). See the comp.lang.c FAQ on null pointers.

  195. Google for "Digital Mars D" by Anonymous Coward · · Score: 0

    Most people who put D info on a web site also mention "Digital Mars" both to give context and to make sure people know what D is being talked about. So googling for "Digital Mars D ..." will usually be much more effective than just seaching for "D ..."

    1. Re:Google for "Digital Mars D" by 91degrees · · Score: 1

      But how am i meant to know to search for Digital Mars without knowing a little about D? Couldn't they have simply called the language "Digital Mars"?

  196. Re:the most interesting part of that table by Anonymous Coward · · Score: 0

    Have you checked out wxWidgets? It is a cross-platform C++ application framework that has a nice virtual filesystem and image handling capability. I know it isn't a language in and of itself, but it is still pretty good.

  197. Unit test suites by Chemisor · · Score: 1

    I just looked at two unit test suites I could find, namely jUnit and cxxunit, and I have to say that I was wrong to say that the debugger is the unit testing support for C++. In reality, assert() is the unit testing support for C++ (and C, of course). The unit testing frameworks appear to be nothing but collections of assert functions combined with a graphical tool to catch them. Of course, every self-respecting programmer has asserts in his code. Advanced programmers often have more asserts than real code, and write error diagnostic routines which "explain" more generic exceptions or dump out relevant data structures. Really advanced programmers write their comments in asserts (Incidentally, do you know this trick: assert(!p && "You must allocate a buffer before passing in the fragment");?) As for the GUI, we have the shell, which prints out the assertion messages quite nicely. C++ assertions are also always fatal, which is a very good thing because it forces you to fix things, unlike the unit test framework's GUI, where failures are ignorable.

    1. Re:Unit test suites by neurojab · · Score: 1

      I think you're still missing the point. The unit test frameworks are quite simple, and you're right that "assert" is a major function... but when you use these frameworks properly, you can fully test your code after every compile!

      Asserts are only half of the picture... how do you plan to validate that the code works?

      Imagine if you've got 200 people working on a project... the GUI is about 3 layers up from yours, and there are three layers below you. How are you going to make sure that your code works? Surely you're not going to test it manually every day.. Just put assertions in the code and have an intern poke at the GUI randomly?

      No, you want to automate it. That's the real point.

    2. Re:Unit test suites by Chemisor · · Score: 1

      > how do you plan to validate that the code works?

      By knowing how it is supposed to work and documenting the boundaries with asserts. Then your randomly poking intern will not be able to complete even a single test run if he screws up (you do require at least basic testing and code review for every checking, don't you?). For example, say you are writing a preprocessor. I had to write one once to substitute variables into a LDAP import file for a setup program. This code was used by a bunch of people, the input being the filename, output buffer (resizable), and the map of variables to substitute. How did I know it worked? By carefully designing the algorithm. I made sure that it correctly resized the buffer for the output when it ran out of room, that there were exception handlers for things like missing files, that substitution worked correctly for all three cases (long->short, short->long, equal length). And then I stepped through the code for all three cases. (You do step through all your new code at least once, right? Or at least somehow make sure that it actually ran?) Then I put in precondition asserts, like an empty filename (this must be checked in the UI by graying out the button), or empty source substitution strings (which were hardcoded in some header file). The output buffer was dynamically resized, so there was nothing to screw up in that parameter. The STL map ensured that there would always be valid objects to substitute. And, if the poor intern passed in something he should not have, well, I can't check for that since I can't know what he intended. He'll have to actually (*gasp*) look at the output.

      > assertions in the code and have an intern poke at the GUI randomly?

      Hell no. He'll have to test his new code, just like I did. Otherwise, no checkin. And don't let interns mess with core components either. They should only work with leaf code and delegate when they find a bug in the core.

      > Imagine if you've got 200 people working on a project.

      Don't have 200 people working on a project. Have 19 groups of 10 people working on 19 separate standalone projects which can be combined by the 20th standalone project. Use the unix philosophy. It really works. Simplify, simplify, simplify. Define interfaces between those projects and ensure they are not broken. Write some assertions and NDEBUG code to verify that the data your component gets is valid and then you'll know your code will work because you have written it, you have stepped through it, and you know how it works and why.

    3. Re:Unit test suites by neurojab · · Score: 1

      I don't know... I still get the impression that you're of the "once good, always good" school, and I'm from the "test always" school.

      >You do step through all your new code at least once, right? Or at least somehow make sure that it actually ran?

      I'll do one better than that. I run it through an entire regression suite every time I make a change.

      jUnit etc... are about automating the ability to drive the code in a predefined manner, writing assertions when something fails. I.E. I have this data structure, I pass it to this method, then I make assertions about the output. This dovetails quite nicely with assertions written in the code itself.

      I agree with the idea to simplify and work on smaller units... that's also why automated testing is so important. It can allow you to regression test your component against someone else's code, also automated.

      Sure, you'll peek at the debugger the first couple of times you run your automated tests, but the days of hammering away at a program manually to verify a small component thereof are over. Components need to be verified independently, then togther in a completely automated fashion. The last thing you want is your intern looking at the output - he can make a mistake. Your xUnit test cases can't.. they've been verified a thousand times.

    4. Re:Unit test suites by Chemisor · · Score: 1

      > I still get the impression that you're of the "once good, always good" school

      I am and here is why: "once good, always good" is the property of good design. In fact, it is probably one of the most important indicators of good design. If you encapsulate your code into components with well defined interfaces, there will be no way for a change to your component to break other components. When you see a break that means one of three things: 1. the application is too monolithic, with components reaching greedy tentacles into what does not belong to them, 2. you changed the component's interface and did not tell your users, 3. the component's interface is either not well defined or it is too complex. In the first case, refactoring is the solution. Separate and simplify; but you already know that. The second case is quite common, and is solved by better communication with the users of your component. When you make a release, note the changes that require code modification; most OSS libraries do this in one way or another. The third case happens when you make kitchen sink components that have no single function. It is simple to verify that function if it is something like "take this data and compress it", but quite difficult when you have an MFC CView derivative which contains the entire visualization code for your 3D CAD. I tend to have extremely simple functions for each component, usually just "convert format A into B" from the bottom all the way to the UI drawlist, so I almost never have any bugs due to a broken algorithm. When I have problems it is always when something doesn't fit into the design. I can not write an automated test to detect such a problem because if I could predict the it, I wouldn't have it. Which brings me to another point:

      > The last thing you want is your intern looking
      > at the output - he can make a mistake. Your
      > xUnit test cases can't.

      If he makes a mistake looking at the output then his code will not work, meaning that it will not properly accomplish its function, meaning that the erroneous result will be obvious in the UI. For example, if he is writing settings into the registry and has to change a number, that number will either be set correctly or it will not be. In a good design his changes will only affect the very narrow functionality that he is working on, namely the sequence of calls to your registry access layer. It would not be possible to affect anything else, so it will still all work.

  198. C post-incremented by ProfessionalCookie · · Score: 1

    Don't you people get it
    C++ = D
    No wonder it compatible with C libraries it's the sam thing!

    1. Re:C post-incremented by Vreejack · · Score: 1

      Actually no. (C++ == C) evaluates as true

      C is not incremented until after the comparison.

      It's a post-frikken increment.

      John Vreeland

      --
      "Will future ages believe that such stupid bigotry ever existed!" -- Ivanhoe
  199. Re:actually, the more important reason for excepti by Trinition · · Score: 1

    A good way of thinking about exceptions is that whenever possible, you shoudl provide a way for the programmer to avoid encountering the exception programatically.

    For example:

    - You can avoid NoSuchElementExceptions by checking the index against the size()

    - You can avoid FileNotFoundExceptions by using File.exists()

    Note that the standard Java API failed this in some cases. For example, how do you determine if a String is parsable as an Integer without potentially getting an Exception? You can't. Of course, all of the work you would need to check such a String for integerness would be nearly as much work as parsing it into an integer anyways, so perhaps there was a method to their madness.

    Anyways, the point is, you are right that exceptions should not be used for normal conditions. Map.remove() returns null instead of throwing NoSuchElemntExceptions, and you can use List.size() to avoid accessing an item that is beyodn the size of the List.

  200. D is a native compiler by WalterBright · · Score: 1

    not a translator. It doesn't emit C code. It emits compiled object files.

  201. C++ rights&wrongs and predictions for successo by Anonymous+Brave+Guy · · Score: 1

    The big problem with the C++ committee is that most of the members don't want to admit the language has major problems. Neither does Strostrup, who has written that only minor corrections are needed.

    In fairness, I think his view (at least as I've seen it expressed) is that only minor changes are needed to the language, as distinct from making changes to the library (where things like proper concurrency support etc. very much are on the cards).

    C++ itself isn't that bad. The language could be fixed.

    I agree and disagree, respectively.

    C++ is actually pretty good at what it's meant for. The problem is usually that it's being used by the wrong people for the wrong job. The fact that half the C++ world is stuck in a time warp and insists on ignoring the past ten years of its development really doesn't help matters.

    On the other hand, clearly it's vastly underpowered compared to some other popular languages today:

    • The STL is crippled without some genuine support for first-order functions/closures.
    • The text data support is a joke.
    • It doesn't have any real support for disjunctive types or pattern matching either.
    • You can get a library to do just about anything, but by God it's hard work, and some libraries are more portable than others.
    • And of course, the syntax is horrible: it tends towards Perl line noise, but without the power and conciseness that make Perl so useful.

    But can this sort of problem be fixed yet still leave a language that is C++? I don't think so. You can't just bolt these things onto an existing framework. They have to be an integral part of the language design, its supporting libraries, and its programmers' mentality.

    What C++ needs is some hardass in a position to slam a fist on the table and say "Fix it so our software doesn't crash all the time". It doesn't have one.

    I don't believe anyone could do that effectively, starting from where we are. As you say, everyone's busy playing with templates, which are all very nice for the elite and may result in a few nice(r) libraries, but which are sod all use to the vast majority of programmers actually using C++ for their day-to-day development. That area is still suffering from readability problems, and silly limitations on basic tools (enumerations, for example).

    I think what's really needed, in the medium term, is a replacement that goes up a level, learning from what has and hasn't worked well in C++. I don't think the next big language will be another variation on the C theme with extra bits added on: that was a smart move in C++'s infancy, but as Python shows so well, a language with a reasonably clean syntax can become useful and popular quite quickly, even if it's quite different from what went before, and commits a few "cardinal sins" (someone's sig around here used to read "Friends don't let friends use whitespace as punctuation" IIRC).

    None of the direct competitors in recent years has really moved that far ahead of C++. I consider adding a GC to be an evolutionary or sideways move, not revolutionary. Several of the other much heralded changes in the Java and C# languages have been steps backwards, which they're now desperately trying to fix, or will given time.

    No, the next big language for mainstream, mid- to large-scale development will look quite different to C++, Java and C#. It will have a clean, programmer-friendly syntax, but one supported by sound underlying models. In particular, it will learn from C++ and provide for "multi-paradigm design" or whatever it's called tomorrow, but with much better support for modular programming and arbitrary calling conventions (including distributed programming). It will have a small but high quality standard library, which will provide the essentials and then establish a framework for more powerful stuff to plug into. It will also

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  202. Re:Nice Comparison... actually yes, it is by Anonymous+Brave+Guy · · Score: 1
    True, the C++ STL has several of the features which are labeled "No" in the comparison. But it appears that one of the design objectives of D is to put features like arrays into the core of the language, rather that relying on some library.

    OK. That's completely the opposite design philosophy to C++, but that's their choice. It's unhelpful to imply that C++ doesn't have those features, however. Any programmer writing in either C++ or D could use them routinely, so both columns should be ticked if it's going to be a useful comparison.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  203. D = C++\?; by raver1776 · · Score: 1

    Exactly why do we need this? In the marketplace, more and more, applications cast in C++ are moving towards a web-centric or Service oriented Architecture (SOA). This looks like the next coming wave of technological development. So... Why do we need a new language that supports backwards "C" compatibility? Is there that much legacy code out there worth preserving? Perhaps we need better business logic mining tools. Ciao

    1. Re:D = C++\?; by Anonymous Coward · · Score: 0

      In case you didn't notice, even java can link to C libraries.

      Also D is not backwards compatable with C, it can link to C, there's a difference.

      Much legacy code worth preseving? Of couse there is. Just about every program u use realise on legacy code. C# was built to take advantage of legacy code.

      D is a *better* C++. It fills the gaps between C# and java. Since D is a systems language it can practically be used for SOA.

      Do you play computer games (one of the biggest industries in IT)? All computer games rely on legacy api's (ie directX/openGL ect...). I can't see to many computer games going web-centric.

  204. These are not disadvantages by Chemisor · · Score: 1

    > it is all too easy to use MI incorrectly and screw things up with improper casting.

    If you use casting, the problem is not with MI, but with your understanding of inheritance. In a good design you never have to cast anything. The only difficulty in understanding MI casting is that you have to realize that you can't cast to another branch. This is because the branches are not derived from each other and just because you have one class that merges both branches, does not mean that there no other such merges. Until you understand this, you should not be using MI. Just as you should not be driving until you know which side of the road to use.

    > it is a particularly difficult feature for compiler writers to implement.

    Not really. It will be difficult for you if only if you wrote your compiler with single inheritance only and hardcoded all your poor assumptions. There will be some tedious code for checking virtual bases and merging of vtables, but it should all be fairly straightforward. The output is simply a vtable pointer for each branch and you need to make sure you know which function call uses which vtable.

    > when there are other language constructs that can do just as good

    Like what? I can't think of any simpler way to implement this functionality. I mean, what can be simpler than two vtables? It's what you would do if you aggregated the interfaces through member variables too.

    1. Re:These are not disadvantages by Anonymous Coward · · Score: 0

      Until you understand this, you should not be using MI. Just as you should not be driving until you know which side of the road to use.

      How charmingly arrogant.
      Are you this pleasant in person?

  205. It's a recursive acronym. by the_Speed_Bump · · Score: 1

    Just like C is.

    --
    "Break out the gin, and the small violin, I'm a raging success as a failure." --Firewater
  206. If you know how to do it. by Wolfier · · Score: 1

    Even "the idiot in the next cubicle" can write code that is fast in C++, without optimization, without tweaking, debugging on, etc. There are a million ways to make a program fast and a few ways to make it slow.

    In Java you at least HAVE to think about making things fast in order for it to happen. No such requirement for C or C++. There are a million ways to make a program slow and some manual optimization effort is required to make it fast.

  207. Instead of picking one, make choice possible. by Qwavel · · Score: 1

    Even if it were politically possible to choose one language, it probably would not be a good thing.

    Instead, we should focus on making it easier for people to use different languages.

    For example, where "C" is currently recommended, allow any GCC language. This can already be done to a certain, very limited, extent (ie. most languages can consume C), but it could be much bettter, eg. if all these languages produced object files that could be linked together. I'm suggesting a compiler option that would produce object files according to this cross-platform GCC/Gnome standard.

    It seems that Troll Tech is dealing with the deficiencies of C++ by creating their own proprietary version of the language. This is a bad approach. The GTK approach of allowing the library consumers to move to newer, better, languages is much preferable. Let's keep doing that.

    (It would be nice to be equally open to Python, Java, and Mono, but I don't think I would want to have all three of these running on my machine at once.)

    1. Re:Instead of picking one, make choice possible. by Anonymous Coward · · Score: 0

      Right, D does not claim to be the one-shoe-fit's all language. It's a system language like C++/C.

  208. Delegates vs pointers by KalvinB · · Score: 1

    what's the difference?

    I recently converted a C implementation of Quadpak to C# (not hard really) and the C version uses function pointers while I had to change it over to function delegates for C#.

    For my purposes I didn't notice any glaring difference. It's functionally the same.

    Is there some feature of delegates that isn't available using a straight pointer?

    Ben

    1. Re:Delegates vs pointers by Anonymous Coward · · Score: 0

      Delegates in D are like method pointers. Function pointers in C are pointers to functions. Functions and methods are different and non-interchangeable.

      Although Walter does talk about combining the two into delegates.

      Franckly I find D function pointers much easyer to remember then C function pointers (which are symbol based which is often harder to remember).

      Internally D function pointers and C function pointers are the same thing.

  209. MOD PARENT UP!! by neutralstone · · Score: 1

    Good god, people, the creator of the language deserves better than a score of 1---especially when he's counter-attacking a piece of FUD that got way over-modded.

    Further discussion on memory management as it relates to D can be found here.

    A slick, responsive 3D fighter game written in D (and somehow unencumbered by the burden placed on it by the garbage collector) can be found here. Source included, so you can see how slick it is on the inside.

    And Walter: Thank you. I've spent a lot of time reading and interpreting the ISO C++ standard, and it usually leaves my brain feeling itchy, flaky, and swollen. With that in mind, I'd just like to say that, after reading all the specs I could find, D (so far) seems to me like the Gold Bond Medicated Powder of programming languages. :-)

  210. 26DD by leonbrooks · · Score: 1

    At least that would be easier to search for.

    --
    Got time? Spend some of it coding or testing
  211. It's called without-interrupts. by voodoo1man · · Score: 1
    If you want hard real-time, you might as well handle multi-threading and garbage collection at the same time.

    The thing that most of the GC naysayers in this thread are ignoring is that you only need to garbage collect when you allocate too much. It's trivial to write your own object pooling doohicky - pre-allocate all the objects that you think you will need, and stick them in a vector (optionally declare it static so if the GC ever runs it won't even look at them). Pop off an object when you need it, return it when you're done (or better yet, mark the entire resource unused at one point in your program), and in case you need more than you thought, just allocate another object as you normally would - the difference is that this object will be there the next time around. This is much more efficient that new/delete in C++ - you don't wait for memory to be fetched from the OS, you don't wait for that memory to be laid out, if you don't need it (and you really don't need it most of the time) you don't wait for object initialization, and you don't wait for deallocation (especially not if you return the whole thing at once!). Object allocation costs at best one function call and integer increment, and at worst that plus the cost of allocating the object; object de-allocation costs at worst one integer decrement (I suppose if you're worried about safety you'd do a range check too). Fancy, dynamically-sized data structures (arrays mostly) need a little search and pointer comparisons, but with hashing it's also pretty cheap. If you need to actually get rid of the thing, you just lose the reference, call the GC, and the whole thing gets reclaimed at once. Oh, and in case you didn't notice, this method has nothing to do with GC besides being safe and fast. I use it all the time with C++ and it works faster (and IMO the style helps prevent and debug memory leaks and other errors better) than manual memory allocation.

    --

    In the great CONS chain of life, you can either be the CAR or be in the CDR.

    1. Re:It's called without-interrupts. by Anonymous Coward · · Score: 0

      This is much more efficient that new/delete in C++

      Actually, this is why you can write your own new and delete operators for classes in C++. For the cases that matter, you provide a tuned or guaranteed allocator, and leave the rest to the global, general purpose, heap manager code.

      The side benefit is that clients of the code don't need to use special functions for allocation. They can just keep on using new, and the client code works whether or not you change the allocator underneath, without recompiling.

  212. Save the Game Industry? by Mr.Oreo · · Score: 2, Interesting

    I'm a long time C/C++ coder, mostly working on games or other real-time apps. Right now, I code in Java (J2ME for cell phones), and after some hiccups, I have to say, I really really like coding in Java. Syntactically, it's beautiful. Code is easy to read, it's super easy to dive into a project and just start working. Eclipse is great to work in, and the MIDP and CLDC libraries are very well designed.

    Popping into a big C++ project (a moder day AAA game for instance) means spending about a week or so of JUST surfing the source tree to find out where everything is and how everything pieces together. In Java, I spend next to no time at all surfing source trees. I can just dive in, and work. A lot of teams get bogged down making engine code work with game code, which means a lot of refactoring.

    Example? When Maxis was working on Sims Online, they spent a large portion of their time (and budget) refactoring nearly 1 million lines of code from the previous team (who had left because of the EA buyout IIRC). At it's peak, they had around 50 engineers refactoring it.

    The only reason game developers aren't using Java, is because it's slow, and not suited for games at all. The speed improvements in 1.5 still mean absolutely nothing to anyone who is looking to push hardware as far as possible.

    For many years I've been praying for a natively compiled Java that has a built in assembler (a lot of intense code still uses assembly for access to processor extensions), some of syntactic rules as Java (all classes in their own file, no multiple inheritance, which I'm still not 100% sure was the right idea).

    I'm stuck using Java for my current project, but in the future, I hope to God that D takes off and becomes the generally accepted successor to C++.

    Perhaps the developers should really look to the games industry and listen to what they have to say, since their one of the only software industries that are pretty much exclusively compiled only (C/C++ onle).

    --
    - Mr.Oreo
    1. Re:Save the Game Industry? by Anonymous Coward · · Score: 0

      D seems right up your ally of your thinking of using it for games. D has taken so many ideas from java it's not funny. You will find that much of your java code will look the same in D, except D is more powerful.

  213. Join the D newsgroup by Anonymous Coward · · Score: 1, Informative

    Hay anyone wanting to put forward some contructive critism join the D newsgroup(at news.digitalmars.com). Who knows you just may help *put the language back on track*.

    Negative additudes are wellcome, D needs feedback from all sectors. By negative additudes, I don't mean we want people to spoil the friendly nature of these group. So if you hate D, come to the group and explain exactly what you hate about it.

    Parhaps there's a solution to be found.

  214. Re:C++ rights&wrongs and predictions for succe by Animats · · Score: 2, Insightful
    I tend to agree with much of the above. But I think that Java and C# are the "next big languages" for the present.

    Strostrup does say that he's reasonably happy with the basic language. I don't agree. If the basic language was OK, there wouldn't be a need for C#, etc.

    C++ has some major outstanding problems, dating from early bad design decisions. Not just C legacy problems, either. Here's a few of them:

    • The original C++ language had no templates, no exceptions, no run time type info, and no references. This led to a horrible programming style in the early years, with big ugly macros, no standard way of handling errors, wide use of unchecked downcasts, and "this" as an assignable pointer. Much of that legacy lives on in running code.
    • You can't implement safe smart pointers in C++. No matter how hard you try, you can't make auto_ptr work right. It's been formally revised three times, without success. The problem is that you have to let a raw C pointer out of the encapsulation to do anything with the object, and that pointer isn't "special" to the language. There needs to be a const-like attribute that says "this pointer can't be deleted or copied to an outer scope". Then you can build safe encapsulations.
    • Iterators and references were both afterthoughts. They should have been a fundamental part of the language. C's ambiguous syntax for pointers, which makes a pointer to an object and a pointer within an array indistinguishable, shouldn't have been perpetuated in C++.
    • A major effort should have been made to make built-in arrays obsolete. Even today, you still see extensive use of C arrays in C++ code. They should be unnecessary. To this day, you can't say "no C arrays or pointers allowed in C++ code" on a project. If you could, there'd be far fewer buffer overflows.
    None of this is being fixed in C++. That's the problem
  215. Re:MOD PARENT SIDEWAYS - SILLY ANALOGY :) by Progman3K · · Score: 1

    I bet you that you can abstract even further in c/c++ than you can in Java, because you have access to literally everything directly; memory, hardware.

    And with pointers, references and all the other syntax c/c++ have that Java doesn't, how could it be less?

    c/c++ is RICHER than Java.

    Don't get me wrong; I LOVE Java, I really do!

    With Java, it WAS simple to create theads of execution that would load classes from disk or create them at runtime, classes that serialized themselves and shot around a network and re-instantiated themselves somewhere else and talked with other systems... I mean come on, it's the COMPUTER WITHIN A COMPUTER, that's what Java is! Pretty cool.

    But equally, you could obtain all the necessary libs to do the same thing in c/c++.

    And in c/c++, you could abstract the mechanism any way you see fit, every module can have a different memory addresing/allocation schemes if you want, and you have all the granularity of control you want.

    What we'd need is a transputer, so that programming languages really WON'T matter anymore.

    c/c++/Java would all be pretty much equivalent in terms of execution speed.

    http://arstechnica.com/cpu/2q00/x86future/isa-fu tu re-4.html

    Scroll down (3rd or 4th paragraph) the page until you get to the paragraph about the HP Dynamo chip.

    It begins "Dynamo is an odd beast."

    It wouldn't matter which language you chose.

    It would really be a question of which tool you felt went with the job at hand and how comfortable you are with that language.

    I'm waitin' fer mah transputer... :-)

    PS - The whole article is great!

    --
    I don't know the meaning of the word 'don't' - J
  216. compile gtkmm under D by llimllib · · Score: 1

    I think that's being a little optimistic. While not technically untrue, I feel that a large C++ library wrapped around a large C library probably requires more than "minor modification".

  217. Language niches by Entropy2016 · · Score: 1

    C for great efficiency.
    C++ for speed-critical object-oriented code.
    Obj-C for very very flexible objects (kicks ass for interface code).
    Obj-C++ for those brief ventures outside of Steve Job's little dream world.
    Java for portable & easily networkable code.
    Asm for the poor poor bastards stuck doing code that must be Godlike (M-M-M-Monster kernal panic!).

    What's "D" supposed to do?

    1. Re:Language niches by Anonymous Coward · · Score: 0

      D is a refactoring of present day language design. Taking the best parts out of all imperative languages. That is, it trys to be a better C++ so you can develop quality software faster.

      Ok there have been a few of these experimental acidemnic languages put out but none of these have taken off like D. I think D is really taking off.

  218. John Vreeland likes broccoli. by ProfessionalCookie · · Score: 1

    Notice it was an assignment, not a comparison. Besides the points is C still gets incremented. It's not like incrementing 'C' would make it 'D' anyway... unless C was ASCII 67.

    Cheers Jonny

  219. Re:actually, the more important reason for excepti by corngrower · · Score: 1
    "Normal" error conditions shouldn't throw exceptions,


    How far do you want to take this? I consider such things as a file open failure due to non-existant file, insufficient privleges, unmounted filesystem, etc., as a 'Normal' condition. If you take it to extremes, your code would look the same as a language without any exception handling capabilites.

  220. R? What about Z? by corngrower · · Score: 1

    Yes, there is a language called Z. I believe it is a functional specification language, or something like that. Maybe some other poster will know more about this.

  221. The Cube language by Anonymous Coward · · Score: 0

    I've been working for a while on some ideas for the Cube language---instead of object-oriented, it cubicle-oriented. For modeling of IT projects...cube has ideas of 'resources' that actionize on 'tasks' in 'cubes'.

  222. Amiga E and Power D by milsim · · Score: 1

    It's not that funny. Amiga E is a pretty good language for starters, think of C and Pascal mix with some support for objects; unfortunately the compiler is written in M68K assembler making it hardly portable. Then there's Power D, which AFAIK is based on Amiga E (unsure about it).

  223. Re:the most interesting part of that table by Anonymous Coward · · Score: 0

    I'm sure there are many so-called C successors. You can't put everyone in a table. Best use languages people actually use as a benchmark.

  224. A=Assm, B=Basic, C, C++, C#, D !! by UK+Boz · · Score: 1

    So D Would be Delphi ? :-) Boz

    --
    www.boznz.com Simple solutions to complex problems.
    1. Re:A=Assm, B=Basic, C, C++, C#, D !! by reapermane · · Score: 1

      Doh! The language B already exists.

  225. Re:try, catch, finally (return values) by irw · · Score: 1

    >>NULL is often (void *)0, which is *technically* valid on some architectures (OS notwithstanding). It's just so unlikely a result that it's safe to use.

    >NO!!!! (void *)0 is not the address of anything (that the C program can use).

    To explain to those who can't follow the point:

    I wasn't talking about C. Nor Unix. Physical memory addressing starts at zero. Therefore a pointer whose value is zero is a valid pointer (its address exists).

    On many (but not all) CPU architectures, address zero is not writeable, but the implementation of memory handling under unix does not require an "invalid" pointer to be zero - simply outside the addressable memory space for the process. Zero is merely convenient (and likely to be protected on the CPU anyway, in the average case).

    My *point* was about in-band error values. Given that different values can be valid or invalid for different operations, functions cannot use consistent in-band errors as the poster to whom I replied noted.

    To emphasise:

    I was observing that value zero is a valid file descriptor, but not (in C) a valid pointer.

    Incidentally, with regard to the C faq, I am aware that the compiler spots the string "(void *)0" and uses the "internal representation for the architecture for an invalid pointer".

    There are ways, however, to force the issue:

    intptr_t ret_arg(intptr_t arg)
    {
    return arg;
    }

    void *ptr=(void *)ret_arg(0);

  226. 10 hits of build target is too much build target by liquiddark · · Score: 1

    a) You still have to test on all platforms (a new version of the JVM counts as a platform, btw) because you can almost never rely on proper and performant support for all features
    b) so yeah, I'd choose my deployment targets and compile the binaries I think are going to end up mattering the most.

  227. Problem solved! by gidds · · Score: 1
    With all the discussion about the future of GNOME with Java/Mono, does D offer hope of a middle-road?

    Problem: Too many incompatible languages.

    Solution: Another incompatible language!

    Hmmm... I wonder what's wrong with this picture...

    --

    Ceterum censeo subscriptionem esse delendam.

  228. BTW by Anonymous Coward · · Score: 0

    That site has many broken and non-existent links.
    (Broken = 404; non-existent = looks like it should be a link, but there is no a tag)

  229. C has Garbage Collection too. by hal2814 · · Score: 0

    I'm getting just a little tired of people arguing that language X has garbage collection while C does not. Garbage Collection is not built into the C language. Then again, dynamic memory allocation is not built into C! How do programmers get by without built in memory allocation? They rely on external libraries.

    Likewise, Garbage Collection can be compiled into C and it is usually done by linking a garbage collection library that will replace the usual mallocs with garbage collection code and replace frees with a noop. That's it. No changing the source code, just your makefile and you too can have garbage collection in C. As an aside, if dynamic memory allocation were built into the language, this method would not be possible.

    1. Re:C has Garbage Collection too. by reapermane · · Score: 1

      Seems like a lot of effort to me when it's already avaliable in D

  230. Re:actually, the more important reason for excepti by Tukla · · Score: 1
    I generally look at whether the condition disrupts the flow of my logic. When I need to open a file, then process it, the "normal" flow is that the file opens without any problems and I can process it. Any result that forces me to break that flow -- like nonexistent files, privilege errors, etc. -- is an exception.

    Of course, there are always the border cases. If I want to open a file for input and process its contents, a missing file would (in my mind) be an exception. But what if the file is present but empty? That's not an exception to me. But, really, either way there is no data to process, so why do I think of one as an exception and not the other? I can't really think of a logical reason; it's just a "gut reaction".

  231. Been there, seen that by sn00ker · · Score: 1
    Was leaving my last job as a sys admin/NOC engineer at an ISP. Good handle on IP, routing, switching, general Cisco stuff, and one of the few people in NZ to know how to drive AS5300s.
    Recruiter advertises for an ISP network engineer - Not for my company, since we didn't use Sun - and turned me down because I don't have a CCNA. If the recruiter had a clue he would've at least let the client reject my CV (which detailed my knowledge of all sorts of ISP-type stuff) rather than rejecting it himself. He might even have managed to close the job a month sooner (that was how long it took before the ad stopped appearing in the paper.

    Sadly, tech recruiters are often nothing more than recruiters who know the difference between RAM and HDD. No technical experience required.

    --
    "God, root, what is difference?" - Pitr, userfriendly
  232. Re: Cfront was free? by some+guy+I+know · · Score: 1

    I wish I had known that.
    I paid mucho bucks for the SAS C++ compiler for the Amiga.

    --
    Those who sacrifice security to condemn liberty deserve to repeat history or something. - Benjamin Santayana
  233. Most people don't know what they are talking about by Anonymous Coward · · Score: 0

    Most of these anti-D messages are very very wrong.
    They come from people who have not tried D before.
    Best bet is to send your questions to news.digitalmars.com (D news room). Half this bunch are ignorant.

    Particularly the GC issue. See:
    http://www.digitalmars.com/d/memory.html

    If you want a GC, it's there. If you don't want it, you can turn it off (completely). That should please both java and C++ fans, but noooo.

  234. Re:Hardware problem? by Arjuna · · Score: 1

    Check out projectudi.org. I think its a little VM just for platform independent device drivers, that should also improve system stability when running a less than perfectly written driver. Goes some of the way you're heading. I at least wish the linux/bsd kernels were written in C++ (a sane subset thereof), or nowadays D.
    Of course, microsoft wants to kill UDI since it implies leveling the playing field windoze is on - imagine universal compatibility with commodity devices...
    'Right to innovate' my arse!

  235. I like it by Anonymous Coward · · Score: 0

    Anyone who avocated the use of just one language is an idoit. D is good for some things and not for others. That doesn't mean it's not a good language.

  236. The major problem with D by reapermane · · Score: 1

    The major problem with D will be getting the message across to organisations that D will save them time and money. It's one of those retorical questions. So many languages have died because they have not beem popular enough.

    Also because a language isn't popular, people assume it's a bad language. Many miths and half/truths result.

    Therefore I think for D to be acceptable to the masses it must first be used by the many indviduals.

    Who knows, with a name like D it may by lucky and take off.

    Appart from that, I can't see any problems with the language itself. I haven't seen one /. email mention actual acidemnic problems with the language.

    MI - Is not a problem with the language, not when you can use interfaces (and mixins are planned). There is no problem that can't be simply solved without MI.

    The comparison list - The argument presented here was not that D was bad, but that it was avaliable in C++ already. Doh!

    Opperators - You simply don't understand how messed up C++ opperators are.

    Webbased - Someone want to make a Djava? This is not a problem, it's simply a wish.

    Come on use your heads an put together some serious (well thought out and researched) arguments.

    Half you you think that there is nothing wrong with C++. I say you've had your heads stuck in the mud to long. This is what people said about C++ when it came out.

  237. Re:They should have a form for ppl with a C succes by reapermane · · Score: 1

    Obviously you haven't tried D. There are better ways to do things then by preproccessor. If you must, you can still use the C pre-proccessor.