Slashdot Mirror


The D Programming Language

dereferenced writes: "Walter Bright, author of the original Zortech C++ Compiler and the free (as in beer) Digital Mars C/C++ Compiler, has posted a draft specification for a new programming language that he describes as "a successor to C and C++". It seems to me that most of the "new" programming languages fall into one of two categories: Those from academia with radical new paradigms and those from large corporations with a focus on RAD and the web. Maybe its time for a new language born out of practical experience implementing compilers."

11 of 530 comments (clear)

  1. Re:Convince me by 32855136 · · Score: 3, Informative

    I'd be interested to see a *true* benchmark

    I've done that - kinda. Wrote several mickey-mouse comparisons (moving memory, calculating pi, etc), in C, C-machine-translated-to-Java and in regular Java.

    The biggest problem was that, for the tasks we were interested in (memory-management, for example) C and Java do it so differently there is no easy way to compare. (Java's habit of creating multiple references to single objects instead of multiple copies of the same object really helps it here).

    In general, Java was 3-4 times slower than C on string manipulation with built-in classes/library functions, but was damn-near identical on heavy maths (Java dropped ~1 second for every 30 secs of calculations.)

    (Visual C++ 6 compiler against Sun's latest JRE for Windows NT. These timings were only ever meant to be rule-of-thumb.)

  2. Re:After C comes P! by RevAaron · · Score: 3, Informative
    Actually, there was a successor to Forth called Fifth. Forth with OO extensions, IIRC. I've not been able to find a reference on the web, but I played around with it in the early nineties, when I was downloading every language I could find off of local BBSes.

    And calling it Fifth fits more so than Further- Forth comes from the word "Fourth," as in the cardinal number. The mythology goes, the filesystem where Forth was first implemented couldn't handle a filename as long as Fourth. ;) Hence, forth.

    --

    Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
  3. Re:Maybe? by MagikSlinger · · Score: 3, Informative

    While I think you have some valid points, you are far too eager to suckle at Microsoft's teat and call the watered down skim soya milk it gives 10% m.f. homogenized.

    I too like VB (quit staring at me like that!), and I agree with you that poor programmers give VB a bad man, but I big to differ on the idea that VB somehow protected you from Microsoft's shifting API's. You've read the reviews for VB.Net? Everyone VB programmer out there is screaming blue murder because the object model in VB has so radically changed that it requires re-learning VB. Yes, I said re-learning VB. MFC has changed their official "ways to do things" with each major release that it's necessary to re-learn MFC every major release. Sure, MS can provide some insulation from their API's, but even their insulation can't protect you from the pointy spikes that poke through everytime MS changes its architecture.

    One other thing:

    An entirely new programming paradigm where everything you ever wanted to do is neatly arranged within the various Class libraries. I know that in and of itself isn't new, but having that kind of support on the OS level IS new.

    As an embittered and disgruntled fan of NextStep, I vehemently disagree with your opinion. :-) You want a seriously kick-ass distributed networking object-based API? Try NextStep's Distributed Objects. Can you say, "Sweeeeeeet!"

    Other than that, I think you made some good points for people to think about.

    --
    The bitter lessons of a veteran coder: http://bitterprogrammer.blogspot.com
  4. D versus C# by Zeinfeld · · Score: 3, Informative
    It would be interesting to know if the guy has contacted Microsoft. Many of the features of D are in C# and vice versa. It would be a good thing if the future of programming languages was not considered the domain of Microsoft alone (bad) or Suns lawyers alone (worse).

    Many of the features look pretty sensisble. There is now pretty unanimous support for dropping Multiple inheritance. The problem with multiple inheritance being that it leads to programs only the original authors understand.

    It is disapointing that the syntax was not changed more radically. I for one am pretty bored with typing semicolons at the end of lines. Using braces for block structure is equally tedious.

    The garbage collector is of the 'stop everything and collect' type, this is not a good scheme as anyone who has seen a PET running Microsoft Basic GC will agree. The incremental GC in .NET is a better scheme, even if it is slower overall. But that is an implementation detail.

    It would be good if people would start to look at adding support for parallel program execution. The threads programming model is very clunky and hard to use, in part because there is no means for the program to perform checks on access conflicts.

    Also a persistence model should be part of any new language. The current division between programming language and database is a lot of wasted overhead.

    --
    Looking for an Information Security student project suggestion?
    Try http://dotcrimeManifesto.com/
  5. D's floating-point model is dangerous by fullcity · · Score: 4, Informative
    D's philosophy about floating-point arithmetic is dangerous:
    On many computers, greater precision operations do not take any longer than lesser precision operations, so it makes numerical sense to use the greatest precision available for internal temporaries. The philosophy is not to dumb down the language to the lowest common hardware denominator, but to enable the exploitation of the best capabilities of target hardware.

    For floating point operations and expression intermediate values, a greater precision can be used than the type of the expression. Only the minimum precision is set by the types of the operands, not the maximum.

    This reflects a terrible misunderstanding of floating-point arithmetic. Decades ago, scientific programmers realized that getting a computer to "just give me the best FP answer you can come up with, I'm sure it's good enough" caused headaches. That's why we have IEEE FP standards that define EXACTLY what the results should be, to the bit.

    If you get different answers on different computers due to different roundoff errors, your software becomes unreliable. It's true!

    People get confused by Intel's 80-bit FP arithmetic. Yes, the FPU expends some effort in rounding the 80-bit result back to 64 bits, but the result is not more accurate than a 64-bit FPU. In fact the answers will be exactly the same--this is mandated by the standard.

    Anyone using floating-point arithmetic for anything serious needs to know exactly what the arithmetic model is. If Walter pursues this philosophy with his new language, he will make it unusable for numerical applications.

    Walter needs to read:

    David Goldberg, "What Every Computer Scientist Needs To Know About Floating Point Arithmetic," ACM Computing Surveys, vol. 23, pp. 5-48, 1991.

    I could not find a copy online, but here is an interview with William Kahan, the Turing award winner who co-developed the IEEE 754 floating-point standard. Language designers should notice that Kahan implicates of Java and Fortran at the end of the article.

  6. After C comes P! by vu13 · · Score: 4, Informative

    First their was BCPL, then B, then C. Logically the next language in this family would be P.

  7. Re:Forth !!!! by steveha · · Score: 4, Informative
    You could extend FORTH easily to do what you describe. FORTH is very extensible. Here is FORTH code to make the first line work:

    : Variable ; IMMEDIATE
    : to SWAP ;
    : be ; IMMEDIATE
    : setting ! ;

    "Variable" and "be" do nothing and compile to nothing; they are just syntactic sugar. "to" does a SWAP so you can say "x to 10 !" rather than "10 x !". "setting" just does a ! (store) operation.

    Actually, you could make "to" and "setting" IMMEDIATE words; you would just need to make them compile in the words they implement. I'm very rusty on my FORTH, but I think you can do it this way:

    : to COMPILE SWAP ; IMMEDIATE

    Then "to" compiles a reference to SWAP, instead of creating a subroutine that calls SWAP and then returns. The IMMEDIATE version saves one subroutine call and one return.

    This would make a nice short article to publish in Dr. Dobb's or some similar magazine, right around April Fool's Day.

    I have fond memories of an April-Fools article on FORTH, describing how to add GOSUB to FORTH. He went through several versions, before finally arriving at this very efficient solution:

    : GOSUB ; IMMEDIATE

    In other words, GOSUB does nothing and compiles to nothing. FORTH is all subroutine calls anyway; it never really needed GOSUB in the first place.

    steveha

    --
    lf(1): it's like ls(1) but sorts filenames by extension, tersely
  8. Re:Garbage Collection vs. Virtual Memory by rossjudson · · Score: 3, Informative
    Nope. Modern garbage collectors certainly don't walk around memory collecting things (and neither do modern heap allocators). All the tabular stuff that indexes memory and structures is usually contained in a small set of pages. Those refer to blocks elsewhere. No page swapping is required.

    Java's class packaging is considerably more than a small step in the right direction. It supports a universal naming convention, based on the internet's naming systems, that can underlie local and remote code. D's modules are a primitive mechanism at best, similar to Delphi's. They're OK for a single organization, but problematic for integrating code on a wider basis.

  9. Nothing special... by frleong · · Score: 3, Informative
    • Dynamic arrays - Some juicy stuff that frees the programmer from using malloc, realloc. Copied from Java or Ada or _________________ ( fill in the blank, strip out unused characters)
    • Fixing some inconsistency issues of C's syntax - some purification to make it prettier - like switch/case accepting strings, using something.size, instead of sizeof(). Nothing by itself is absolutely necessary. Syntactic sugar.
    • Unicode character support - Interesting, but usually people just got used not to embed Unicode strings in the source code. Besides, they simply renamed wchar_t to unicode just to make sure that D supports Unicode.
    --
    ¦ ©® ±
  10. Re:Convince me by JohnA · · Score: 4, Informative

    Read again. Nowhere do I compare the speed of a VM executed program to a native compiled one. Java is not the end all, be all of languages, but it is much more than the applet creation toolkit it was in 1995. Will fourier transforms ever run as fast in a VM as they do in optimized native code? Probably not. But, then again, how many of your programs are doing fourier transforms

    It's simply a right tool for the right job issue. Plain and simple

  11. D already exists.. by gatkinso · · Score: 4, Informative

    It is a scripting language for a X Window based RAD tool called Telesys(? - maybe that was the name of the company that made the software).

    --
    I am very small, utmostly microscopic.