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."

59 of 791 comments (clear)

  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 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.

    2. 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
    3. 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.
    4. 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.

  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 b4rtm4n · · Score: 5, Funny

      Visual D

      Cue loads of VD jokes :-D

      --
      "goatse? What's that? Anyone have a link?" - AC
    2. 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
    3. 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.

    4. 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.

  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 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.

    8. 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.

    9. 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...
    10. 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.

  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).

  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
  6. 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
  7. 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!
  8. 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.
  9. 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 !!
  10. 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)

  11. 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
  12. 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 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.

  13. 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.

  14. 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.

  15. 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.

  16. 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.

  17. 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
  18. 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 */
  19. 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.

  20. 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.

  21. 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)

  22. 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++

  23. 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.

  24. 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 ]
  25. 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.

  26. 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.

  27. 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
  28. 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.
  29. 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++.

  30. 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.

  31. 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.

  32. 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
  33. 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.

  34. 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
  35. 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....

  36. 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.

  37. 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)
  38. 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.