Slashdot Mirror


The D Language Progresses

xsniper writes "D made its debut here on Slashdot in August 2001. Since then, many new features have been implemented, to include: operator overloading and slew of additional functionalities. It was featured as a cover story for the February 2002 issue of Dr. Dobb's Journal, and has been ported to the UNIX environment. I encourage programmers to revisit the specs to see how Walter Bright has addressed their concerns. A copy of the compiler is also available for testing. I'm sure some would be surprised by the achievements made thus far."

18 of 484 comments (clear)

  1. What is D? by Anonymous Coward · · Score: 5, Informative

    What is D?
    D is a general purpose systems and applications programming language. It is a higher level language than C++, but retains the ability to write high performance code and interface directly with the operating system API's and with hardware. D is well suited to writing medium to large scale million line programs with teams of developers. D is easy to learn, provides many capabilities to aid the programmer, and is well suited to aggressive compiler optimization technology.
    D is not a scripting language, nor an interpreted language. It doesn't come with a VM, a religion, or an overriding philosophy. It's a practical language for practical programmers who need to get the job done quickly, reliably, and leave behind maintainable, easy to understand code.

    D is the culmination of decades of experience implementing compilers for many diverse languages, and attempting to construct large projects using those languages. D draws inspiration from those other languages (most especially C++) and tempers it with experience and real world practicality.

    Why D?
    Why, indeed. Who needs another programming language?
    The software industry has come a long way since the C language was invented. Many new concepts were added to the language with C++, but backwards compatibility with C was maintained, including compatibility with nearly all the weaknesses of the original design. There have been many attempts to fix those weaknesses, but the compatibility issue frustrates it. Meanwhile, both C and C++ undergo a constant accretion of new features. These new features must be carefully fitted into the existing structure without requiring rewriting old code. The end result is very complicated - the C standard is nearly 500 pages, and the C++ standard is about 750 pages! The reality of the C++ compiler business is that few compilers effectively implement the entire standard.

    C++ programmers tend to program in particular islands of the language, i.e. getting very proficient using certain features while avoiding other feature sets. While the code is portable from compiler to compiler, it can be hard to port it from programmer to programmer. A great strength of C++ is that it can support many radically different styles of programming - but in long term use, the overlapping and contradictory styles are a hindrance.

    It's frustrating that such a powerful language does not do basic things like resizing arrays and concatenating strings. Yes, C++ does provide the meta programming ability to implement resizable arrays and strings like the vector type in the STL. Such fundamental features, however, ought to be part of the language. Can the power and capability of C++ be extracted, redesigned, and recast into a language that is simple, orthogonal, and practical? Can it all be put into a package that is easy for compiler writers to correctly implement, and which enables compilers to efficiently generate aggressively optimized code?

    Modern compiler technology has progressed to the point where language features for the purpose of compensating for primitive compiler technology can be omitted. (An example of this would be the 'register' keyword in C, a more subtle example is the macro preprocessor in C.) We can rely on modern compiler optimization technology to not need language features necessary to get acceptable code quality out of primitive compilers.

    D aims to reduce software development costs by at least 10% by adding in proven productivity enhancing features and by adjusting language features so that common, time-consuming bugs are eliminated from the start.

    1. Re:What is D? by -strix- · · Score: 5, Insightful

      I understand the goal of D, but personally I like the idea in C and C++ where the base laguage is simple (especially C) and all the complicated stuff is in libraries. It makes it easy to get started with the language and learn the more powerful stuff as its needed. It seems to be the goal of D to toss a bunch of stuff in the language itself and let the programmer sort it out. I could imagine it being a real pain for a new programmer to learn a language like that.

    2. Re:What is D? by macrom · · Score: 5, Funny

      D aims to reduce software development costs by at least 10% by adding in proven productivity enhancing features and by adjusting language features so that common, time-consuming bugs are eliminated from the start.

      You know, the above little blurb had me going until this statement. For Chrissake, why don't you just prefix it with "The following marketing fluff statement was divined specifically so non-technical, pointy-haired managers could force yet another programming language on already overworked developers." I would have expected more from computer scientists than this. How is the world can you design a programming language, assume that it will automatically meet my needs, then assume that it will reduce my costs for development, which are completely unknown to you? I'm afraid in this case, ASSUME makes an ASS out of U and not me.

      I mean, you'll never hear (nor have you heard in the past) Bjarne claiming that C++ will solve your development ills. Hell, I don't even think Microsoft has claimed that C# will reduce your costs by a specific amount.

      Wait...what did you say? The D programming language will get me laid? Not laid off? Where's that compiler again...?

    3. Re:What is D? by SecretAsianMan · · Score: 5, Insightful
      I like the idea in C and C++ where the base laguage is simple (especially C)

      While I won't dare disagree with you on C, C++ is not simple! Perhaps you should read a little more about it to understand. Things I personally object to in C++ are:

      • The multiple casting notations: ( type ), foo _case< type >
      • Excessively arcane template system
      • Every design-of-syntax error listed in the D site's overview
      • Retarded naming scheme, small size, and wierd design of standard library. The damn thing's almost useless.
      So basically, C++ is anything but simple. It's a big, bloated monster and is loaded with nasty cruft.

      One final bitch: I want the person pulled into the street and shot who was responsible for the font used in the Stroustrup C++ book's code examples. Who the hell writes code in an italic, proportional, serif font?! The only thing more painful than programming in C++ is reading about programming in C++.

      --

      Washington, DC: It's like Hollywood for ugly people.

    4. Re:What is D? by ebyrob · · Score: 5, Informative

      C is a powerful language

      Whenever I think about language utility I always think of the gallery of CSS descramblers. Here we see a CSS descrambler in C that is 434 bytes long and runs at better than 10 times the speed of the next smallest implementation (472 bytes of perl code).

      Is there another general purpose language around that can solve this problem with equivalent portions of simplicity and performance?

      I think incompatability, lack of design work and other general language misuse are more to blame for problems in most C code than the language itself. Nearly any language can be used successfully and effectively and nearly any language can be abused.

      Will C be the most widely used programming language for the next 20 years? Hopefully not. Will C continue to be used effectively in the next 20 years when appropriate? Hopefully so.

  2. Of course not by autopr0n · · Score: 5, Funny

    The next language should be named C+=2!

    --
    autopr0n is like, down and stuff.
  3. almost up my alley.. by gothamNY · · Score: 5, Funny

    As soon as they get to F, which I am intimately familiar with, I might pick it up..

  4. A Religion by bahwi · · Score: 5, Interesting

    "It doesn't come with a VM, a religion, or an overriding philosophy."

    Not a religion? Neither was C. Neither was Java. Neither was C++. Neither was vi. Neither was Emacs. I think we all know where this is going and that that statement should be considered pure FUD. And a new language covered in FUD is not a good thing, even if it look like a good thing(tm).

  5. Re:Shouldn't it be 'E'? by tfinniga · · Score: 5, Funny

    Actually, C++ is being post-incremented, so this iteration C++ is the same as c, but next time around it'll be great!

    --
    Powered by Web3.5 RC 2
  6. D Language from early 80's by MichaelCrawford · · Score: 5, Interesting
    A friend of mine at CalTech named Mike Roberts created a language called D when he was in high school, because his parents wouldn't shell out for a BASIC compiler for his DOS PC. We were both in the high school class of '82 so this would have been around '81 or so.

    Unfortunately, his original D compiler was written in BASIC, which he ran interpreted, so compilation was slow. In order to speed up the interpreter, he used the sort of "source code compression" that is illustrated at Chuck's Power Koding - removing any unnecessary spaces, using long source lines and having as few actual lines as possible.

    (This kind of ancient interpreter didn't use byte codes - if you looped ten times, you'd parse the loop's source code ten times!)

    We suggested that he rewrite his D compiler in D so he could get it to compile faster. He decided to do that, and worked really hard at it but got it working after some time.

    As a complication he improved the language, but it meant that his old compiler wouldn't compile the newer kind of D code. I think what he did was make two revisions of the D-written compiler, one written in the old syntax that would understand the new, but could be compiled by the BASIC version and then an update that was written in the new D that could compile itself.

    It was a sort of mix of Pascal but with lots of convenient stuff like BASIC string handling mixed in. I don't think the language would have made any computer scientists happy - D was designed to suit Mike's personal style.

    He used it at first to write an Adventure-style game (a text adventure) that he and another friend designed.

    Later he wrote a text-adventure compiler, where he could write a specification file for a text adventure, process it, and an executable file for a text adventure would be generated.

    He didn't have to get a real summer job because he was selling these generated games to game software publishers!

    Mike was an amazing programmer. He taught me a lot of what I knew about C and x86 assembly early on.

    This was all on 640 kb 8088 DOS PC's that were outfitted with whizzy 10 MB hard drives. The students in the computational physics lab were expected to use the hard drives only during class, and to store their personal files on floppy when we weren't actively working at the PC's.

    So his D language compiler would fit on a floppy. The old 5 1/4" inch kind, that really flopped. I think they stored 360kb.

    I wonder whether we would all be better off if programmers designed their own personal languages just to suit their own personal styles. Yes, there would be portability problems but wouldn't we be more productive?

    I got my own chance to hack a whacky compiler. This was a team effort though and I was just a contributor. Star Sapphire Common Lisp manages to run a complete common lisp environment with MicroEmacs on a 640kb DOS 8088 PC.

    The way it does that is by swapping to an 8 MB backing store file. But the 8088 doesn't have an MMU, you say? That's right - we operated the virtual memory manually, by writing C code that would explicitly get or put each lisp cons from or into the VM system with a function call.

    It made it ... interesting ... to operate on complicated data structures. I designed the implementation of the lisp scoping rules, among other things.

    Oh yeah, and I was the source code control system and project manager. We didn't have a network - networks were way too expensive in 1986. What I did was wait until late when all the other programmers went home, copy the changes off all their machines onto floppy, integrate them on one machine and then copy the new release onto everyone's PC.

    Kids these days. Don't know when ya got it good.

    --
    Request your free CD of my piano music.
  7. The evolution of languages by DarthWiggle · · Score: 5, Interesting
    You know, I've spent a lot of time thinking about the proliferation of languages. We have Assembly. We have C. We have C++. We have Java. We have Cold Fusion, PHP, and ASP.NET. We even have iHTML or whatever that bastard offspring of HTML was called.

    What's the purpose of creating entirely new languages? Is a new language even entirely new, or is it an evolution of older languages incorporating new concepts and methodologies? Or is the creation of a new language just a way of leaving a mark? Or, even worse, is it a manifestation of that damnable desire to start from scratch every time? (I'm afflicted by it... most coders I know are afflicted by it...)

    Here's what I'd like to know, in my limited knowledge of languages: What languages out there are truly modular? Are there any languages that encompass basic logic principles and which are then able to be augmented by blackboxed modules? So, if you had a language that needed string concatenation, you could whip up a string concatenation module that would then become part of the language.

    Now, I'm walking a semantic line here, because you can presumably do all that by writing header files, includes, classes, etc. that contain new logic within the structure of the language. But what I mean is a language that by its nature is abstracted and modular, even to the point where the syntax of, say, control structures could be modified in a module?

    And, if the answer to my question is "Well, hell, you can do that in C!" then why do we need to bother writing a new language? Is it just to keep things fresh and interesting?

    It just seems that with all the many languages I've learned and used, there's very little that I can think of that one language can do that another language can't. Where doing something in one language is harder than in another because the structure of the language makes it awkward, maybe that points to a language that needs to be made obsolete.

    I guess the root question I'm asking is: Are there any truly novel languages out there, or are they all just variations on a common theme, with shared shortcomings and much duplication of effort?

    Be gentle. :)

    1. Re:The evolution of languages by aminorex · · Score: 5, Interesting

      There are three fundamentally good reasons to design
      a new programming language:

      (1) A new model of computation or machine. Lisp,
      Prolog, Algol, Forth, SNOBOL, ML, BLISS-32,
      APL, SETL, Parallation Lisp, Smalltalk, Self
      are examples.

      (2) A new kind of progamming methodology or
      application domain. Bourne/Korn shell, Perl,
      C++, Eiffel, Sather, Logo, PHP are examples.

      (3) Incremental improvement derived from
      practical experience. Java, C#, Kylix/Delphi,
      Visual Basic, Haskell, D are examples.

      Each of these can make serious contributions to
      the state of the art. The innovations of the
      first type are more fundamental, more profound,
      but also more academic in nature, and take some
      time to provide practical improvements in the
      art of practice. Those of the second and third
      kind can provide more immediate and accessible
      improvements in reliability, productivity, and
      feasibility of practical development.

      Yes, there is a tendency to create vanity
      languages. If D ever was that, it has progressed
      far beyond, if a half-hour's reading has not
      deceived me regarding it's design. Whether it's
      implementation has or will ever have progressed
      to the point where it can fulfill its potential
      as an innovation of the third kind... I just don't
      know.

      --
      -I like my women like I like my tea: green-
  8. D == Java? by hebble · · Score: 5, Interesting
    1. No multiple inheritance
    2. All objects accessed by reference on the heap
    3. Not source-compatible with C
    4. No namespaces
    5. All member functions are virtual (unless the compiler figures out they don't have to be)
    So basically, we'll still need C++ for a bunch of things. At least it's got templates, I guess.

    Also, it's a bit funny that the preprocessor is mentioned twice under "Features to Drop." This guy must really hate the preprocessor. :)

  9. Menage Theory by Scotch+Game · · Score: 5, Funny

    Eh. The way I see "D" is this:

    C++ was alone for the night when Eiffel stopped by, noticing C++ was by itself, "just for a few drinks". Well, things started to get out of hand and just then Java walks in. Tense moment. Awkward silence. But to C++'s relief, Java joins in.

    Well, as luck would have it, Java gets pregnant but the three of them have found they really enjoy each other's company, they balance each other out in certain areas, so they buck convention and all move in together and raise the kid under an "alternative" family, and hey, there's nothing wrong with that. They call their kid D, and while he's still young and has a lot to learn, he's got features, interfaces, delegates and assertions built in. He might just turn out all right after all.

    Watch for the movie, starring Richard Gere as C++ (he's older and has a rumored past, but he'll give the rest of the case a few pointers), Catherine Zeta Jones as Java, and Renee Zellweger as Eiffel (she's hot, but underappreciated). Lil' Bow Wow will guest star as D.

  10. Oh great... by ttfkam · · Score: 5, Insightful

    Yet another way to write and manipulate ints, floats, struct, and classes.

    Why don't people put as much effort into designing standardized interfaces for networking, threading, forking, database access, distributed logic, graphics, etc.

    He goes on and on about how we need unified syntaxes for unit testing, inline assembly, assertions, etc., but is curiously silent with regard to the above issues.

    What are the killer apps? Apache? OpenLDAP? OpenOffice? Mozilla? Konqueror? Photoshop? Gimp? Quake? Neverwinter Nights? Crystal Reports? Gaim?

    Now with that list in mind, how does D make anyone's life simpler? Need a TCP/IP socket? Sure! Just use the POSIX one...unless you're on Windows...or coding for BeOS... What about talking to a database? Well there's ODBC implementation #1, ODBC implementation #2, native database-specific API #1, etc. Well at least there's graphics right? OpenGL all the way...except when you need DirectX...or the framebuffer interface... And for GUI libraries, we have GTK+, Qt, FLTK, MFC, XUL, etc. Along those lines, do you use Gnome or KDE for your object model? Do I write to libxml or use some COM wrapper for MSXML3.DOMDocument?

    What good is uniformity in a complex type when anything I want to do with the language that implements it requires an unending list of non-D libraries that throw uniformity out of the window? Please explain to me how my life is enriched by this language? Please explain how solves more problems than it creates?

    Sure Java, Python, et al have their share of problems, but at least I can open a socket or a filehandle without doing market research on libraries first. At least code written in those languages is readable by someone who knows the language. Database calls look the same no matter your operating system. That's what I want. Not just some new and exciting method for representing imaginary numbers.

    And while we're talking about data types, he writes at length about how ints, longs, floats, etc. are all well-defined sizes unlike in C even though saying int16, int32, and int64 would be much easier to read and helpful. In addition, while the other types are well-defined and char is well-defined as a single 8-bit byte, wchar is sometimes 2 bytes, sometimes 4 bytes, and could be something else in the future depending on the wind. Ask the i18n coders about their experiences with wchar_t. Most end up using an avalanche of #ifdefs or just sidestep it altogether with their own array of bytes. Why? Because sometimes they're using UTF-16 and other times it is UCS4. You need to know how big the character type is! It's not something you leave up in the air! char16...char32... Are these too much to ask for?

    I hope to god that no one actually adopts D for real work in the near future. If they do, they will run into the limitations I mentioned above and figure out some hack to get it to work. Hack begets hack begets hack and you are left with another bloated language lacking uniformity that people will bitch about on tech discussion boards. And then some person will say, "Hey! I've got this new language that fixes all of those inconsistencies with D that we all hate."

    1. Wash
    2. Rinse
    3. Repeat

    --

    - I don't need to go outside, my CRT tan'll do me just fine.
    1. Re:Oh great... by Tumbleweed · · Score: 5, Insightful

      Okay, then, we should just never make any other computer languages until someone can come up with one that solves every one of those problems you listed.

      If someone finds that D solves problems they have, or if they just plain like the syntax better (and how can you NOT, compared to C and C++ (and Java)??), then there's nothing wrong with someone using D. Hell, I'd use D just for the string-handling alone (one reason why I think C is pretty ridiculous for a general purpose language).

  11. The Bell Labs answer by devphil · · Score: 5, Funny


    There's an axiom at Bell Labs (where C and C++ came from, for those who don't know):

    Some languages are designed to solve a problem. Others are designed to prove a point.

    --
    You cannot apply a technological solution to a sociological problem. (Edwards' Law)
  12. I've Known Walter a Very Long Time (Some History) by ChaoticCoyote · · Score: 5, Interesting

    ...and I have great respect for his work. Back in the early 90s, he had the first and best C++ native-code compiler, which he built on his solid Datalight C tools. Walter's compiler became Zoretch C++, which became Symantec C++, which became their Java compiler (after a fashion). I used Zortech C++ up until the time Symantec let it die on the vine. I even wrote the official numerical programming docs for Zortech and Symantec C++.

    I remember sitting around with Walter and his buddies, talking about how much trouble Walter had in implementing C++. This was before the ISO standard, and to some extent, before the ARM definition. Walter isn't a fool; he's one of the brightest programmers I've ever met. When C++ was first emerging, I talked with compiler developers from Watcom, Microsoft, and others; all found C++ to be more than a challenge. Stroustrup invented an incredible power tool that ANSI complicated through the committee process; I am impressed that anyone has come close to making this monster work.

    D is Walter's attempt to move beyond C++, based on his experiences in writing C, C++, and Java compilers. I'd say he has an excellent understanding of the issues involved.

    Do I use D? No. While a good effort, D simply doesn't address my programming needs. When I look at a "new" language, I consider O'Caml or Haskell or something that provides very different paradigms. I don't believe it is possible to define a single, all-purpose programming language that scales across the spectrum of applications. I haven't got anything against D, but it doesn't do anything for me that I can't get elsewhere.

    Whther or not I use D is irrelevent to its future. Walter Bright has created yet-another-C-derivative; it may succeed, or it may end up like the hundreds of "good ideas" that never caught on. But don't make the mistake of thinking Walter is foolish; he has a fine mind and has produced brilliant software before. He once started from obscurity to build the first useful XC++ compiler for MS-DOS and Windows; I will not be surprised at all if he proves his mettle again with D.