Slashdot Mirror


The D Programming Language, Version 1.0

penguinblotter writes in a journal article: "Soon, Walter Bright is scheduled to release version 1.0 of the D Programming Language. D is a systems programming language. Its focus is on combining the power and high performance of C and C++ with the programmer productivity of modern languages like Ruby and Python. Special attention is given to the needs of quality assurance, documentation, management, portability and reliability. D has appeared on Slashdot a few times before, and Walter has continued to add more and more features. Most Slashdot community comments in these articles have been offered on feature X or spec Y without reading through the extensive D newsgroup archives. It has been here over the past seven years where extremely gifted and experienced programmers hashed out discussions and arrived at excellent implementations of all the ideas discussed." Read on for the rest of penguinblotter's writeup.
For those with a C/C++ background, D offers:
  • native code speed
  • extremely fast compilation times
  • garbage collection (although you can manage your own memory if you want)
  • OOP - by reference only, easy initialization, always virtual
  • cleaner template metaprogramming syntax, more powerful templates, as well
  • built-in dynamic and associative arrays, array slicing
  • versioning (no preprocessor madness)
  • link-compatibility with C
  • nested functions
  • class delegates / function pointers
  • module system
For those with a C#/Java background (a shorter list, but one with big wins):
  • similar syntax
  • No virtual machine or interpreter
  • built-in unit testing and design-by-contract
These two comparison sheets can go into more depth on how D stacks up against other languages.

From D's creator:
For me, it's hard to pinpoint any particular feature or two. It's the combination of features that makes the cake, not the sugar, flour or baking powder. So,
  1. My programs come together faster and have fewer bugs.
  2. Once written, the programs are easier to modify.
  3. I can do (1) and (2) without giving up performance.
Get your compilers and start hacking D!
  • DMD (Digital Mars reference compiler, Windows & Linux, x86)
  • GDC (GCC front-end)

570 comments

  1. This won't work... by PurifyYourMind · · Score: 5, Funny

    ...it's just another version race. D may have won for now, but someone out there is already working on the E programming language. ;-)

    1. Re:This won't work... by 0racle · · Score: 3, Funny

      Now, after F do we get G or 10?

      --
      "I use a Mac because I'm just better than you are."
    2. Re:This won't work... by doctormetal · · Score: 1

      Someone Did that years ago.
      Bu seriously: Why do we need yet another programming language?

    3. Re:This won't work... by butlerdi · · Score: 1

      Been around a long time already ... http://erights.org/ and very good it is as well

      --
      "If the King's English was good enough for Jesus, it's good enough for me!" -- "Ma" Ferguson, Governor of Texas (circa
    4. Re:This won't work... by __aaclcg7560 · · Score: 1

      Yes, but don't forget the conspiracy by publishers to charge huge amount for doorstoppers... I mean reference books... that comes out every year whether the information is old or updated.

    5. Re:This won't work... by Nasarius · · Score: 1
      Why do we need yet another programming language?
      Because C and C++ suck in many ways. The number of useful languages that can be compiled to native code is very small. I'm not sure about D, though. I'm looking through the tutorials, and it seems like strings are implemented as C-style character arrays. That seems incredibly stupid and Unicode-hostile.
      --
      LOAD "SIG",8,1
    6. Re:This won't work... by jlarocco · · Score: 4, Insightful
      Why do we need yet another programming language?

      Exactly. There's already Fortran and COBOL, everything else is superfluous.

      Seriously though, why don't we need another programming language? It's not like we only get a finite number of them. We're not going to run out of space or anything.

      If it doesn't interest you, don't use it.

    7. Re:This won't work... by 0racle · · Score: 2, Insightful

      Did you say the same thing when Python or Ruby were created? People do things in different ways, different languages end up with their strengths and weaknesses that way. So until there is a perfect language that is all things to everyone, yes there is always a need for another language.

      --
      "I use a Mac because I'm just better than you are."
    8. Re:This won't work... by Master+of+Transhuman · · Score: 0, Flamebait


      Do what I do - download the books as ebooks from some illegal ebook site. If there's any interest in a book at all, somebody's made an ebook out of it already. Might be harder to find than a popular song, but it's probably out there somewhere.

      The same thing is happening to publishers as is happening to other media - they just don't realize it yet, but physical books are obsolete. Their business model is going to have to change just like the music industry - except I suspect they're going to find it a lot harder to accept that than even the music business has.

      --
      Richard Steven Hack - This sig is TOO GODDAMN SHORT TO DO ANYTHING USEFUL WITH! MORONS!
    9. Re:This won't work... by jb.hl.com · · Score: 0, Offtopic

      The same thing is happening to publishers as is happening to other media - they just don't realize it yet, but physical books are obsolete. Their business model is going to have to change just like the music industry - except I suspect they're going to find it a lot harder to accept that than even the music business has.

      Their business model must change to cope with freeloaders like you. Presumably, the new business model will be "give everything you invest money in away for free", as the "new business model" mooted for the music industry is.

      *sigh*

      --
      By summer it was all gone...now shesmovedon. --
    10. Re:This won't work... by tcopeland · · Score: 0, Offtopic

      > Do what I do - download the books as ebooks from some illegal ebook site.

      Fortunately, enough people feel this is wrong to keep book publishers in business, even for niche markets. Also, ebooks are still a pain. I'm not sure which is the more significant factor...

    11. Re:This won't work... by spitzak · · Score: 0, Flamebait

      You are apparently totally ignorant of modern design if you think storing strings as bytes preculdes Unicode. There is something called UTF-8. Look it up sometimes. You might need to hit yourself with the cluestick a few times to remove the delusion that there is some advantage in having all the glyphs take the same number of bits and/or that there is any solution out there where the glyphs do all take the same number of bits. Hints: 1.Text is made of WORDS, sentences, paragraphs, lines, and many many other structures that are variable length. 2.There are things called "surrogate pairs" in utf-16. 3.There are "combining characters".

      The fact that D jettisoned a whole lot of crap for "wide characters" is one of the best indications that they get it and know what they are doing!

    12. Re:This won't work... by Sterling+Christensen · · Score: 1

      If you use a dchar when you foreach over a char array it will parse UTF8 for you. Most of the string functions support unicode.

    13. Re:This won't work... by tcopeland · · Score: 1

      > You might need to hit yourself with the cluestick
      > a few times to remove the delusion that there is some advantage
      > in having all the glyphs take the same number of bits and/or that
      > there is any solution out there where the glyphs do all take the same number of bits.

      Hm, doesn't UTF-32 do just that? Quite a bit of wasted space... but you can certainly index into it quickly.

    14. Re:This won't work... by jyoull · · Score: 1

      wow. that was unnecessarily harsh. Your words would have meant a lot more without all the invectives.

    15. Re:This won't work... by cmeans · · Score: 1

      The language naming started at A, not 0.

    16. Re:This won't work... by TERdON · · Score: 4, Informative
      Now, after F do we get G or 10?


      Either it'll be called 10, or H. G, has already been taken, not only once, but twice.

      For your reference (kudos goes to Wikipedia), the following single letter (sometimes including some additional nonalphabetic characters) have also been implemented:

      A+ A++ B C C-- C++ C# D E F F# G (now known as Deesel) G J J# J++ K L M4 Q R S S2 T X10

      So - that only leaves you the letters H, I, N, O, P (sic!), U, V, W, Y and Z if you don't want to have a name clash with another programming language. Technically, M and X are followed by numbers in the previous examples, so you could argue for them as well, and even A (as it has a plus behind the letter)

      I'm mostly surprised that noone has thought of a (P)rogramming language. :)
      --
      I have a really elegant proof for Fermat's last theorem. If this sig was only a bit longer...
    17. Re:This won't work... by Anonymous+Brave+Guy · · Score: 1

      I'm mostly surprised that noone has thought of a (P)rogramming language. :)

      Sorry, someone's already been there and done that. :-)

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    18. Re:This won't work... by jd · · Score: 1

      w and Y are GUIs. Z is an ISO-ratified specification language - and a damn good one at that.

      --
      It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
    19. Re:This won't work... by TheRaven64 · · Score: 3, Interesting

      UTF-32 does, indeed, do that. It is quite a good way of working internally. You can do things with UTF-32 much more efficiently than with UTF-16 or UTF-8 (e.g. searching for a character just requires you to compare each 32-bit value to the target, without having to check it isn't a special character that is the first in an escape sequence). Most modern processors come with a vector unit that can handle vectors of 32-bit integers, so if you have to handle large quantities of text you can speed certain things up even more by running streaming calculation on the vector unit.

      --
      I am TheRaven on Soylent News
    20. Re:This won't work... by Zerathdune · · Score: 2, Informative

      actually, B was a modification of BCPL, not A (to my knowledge there was never a language called A.) BCPL was an enhancement of CPL.

      --
      No single raindrop believes that it is responsible for the storm.
    21. Re:This won't work... by dosius · · Score: 1

      I have found one particular children's author (Carolyn Haywood) impossible to locate in electronic format. Used to have a physical copy of "Annie Pat & Eddie"... I would defy you to find THAT on eMule.

      On the other hand, Roald Dahl was a snap.

      -uso.

      --
      What you hear in the ear, preach from the rooftop Matthew 10.27b
    22. Re:This won't work... by Anonymous Coward · · Score: 0

      Some technical books on IT subjects that become obsolete in one year or less are too expensive to purchase multiple times in say 3 years. Ebooks tend to be cheaper and can be updated without throwing away tons of paper (read as: killing trees). I'm not going to say that ebooks can replace traditional books now, but when decent electronic readers become widespread (ie with good screen size/resolution, long battery life and absolutely no DRM) they eventually will. In the meantime I download all books in pdf from pirate sites or p2p, then buy the most useful ones (yes, I'm a freeloader too -and- also have a bookshelf filled with books I paid for).
      I did the same thing with music and movies too but when music/movie companies started bullying consumers through lawsuits I stopped buying anything from them.

    23. Re:This won't work... by LunarCrisis · · Score: 3, Informative
      Though I agree with you for the most part (finding the nth character in a UTF-8 string is unnecessarily long), this is wrong:

      searching for a character just requires you to compare each 32-bit value to the target, without having to check it isn't a special character that is the first in an escape sequence UTF-8 was designed so that no complete set of bytes representing a character occurs as a substring of any other. This makes the search problem into a simple search for a string inside another string. The searching routine doesn't even need to know whether or not it's a UTF-8 string or not, just as long as it doesn't mangle the last bit.
      --
      Mr. Period: Nine is the one that's right by ten!
      Nine: One day I will kill him. Then, I will be Ten.
    24. Re:This won't work... by CableModemSniper · · Score: 1

      Where enhancement = simplification.

      --
      Why not fork?
    25. Re:This won't work... by TERdON · · Score: 1

      I wrote (p)rogramming language, not (apl)rogramming language, so you better explain how and where that language is called P... :)
      (I also know that there are a lot of languages with names based on PL, but I was referring specifically to languages referred to as merely "P")

      --
      I have a really elegant proof for Fermat's last theorem. If this sig was only a bit longer...
    26. Re:This won't work... by UncleTogie · · Score: 1

      The same thing is happening to publishers as is happening to other media - they just don't realize it yet, but physical books are obsolete.

      I'll have to argue here with you. While I might be able to research faster using electonic medium of most sorts, the feel of a book in hand is one of life's simple joys. A book needs no internal batteries, rechargers, dongles, styluses, or assembly [unless it's a book on assembly...]

      In short:
      You can read it in a box.
      You can read it with a fox.
      You can read it in a house.
      You can read it with a mouse.
      You can read it here or there.
      You can read it ANYwhere.
      I think I like Green Eggs and Ham.
      I think I like it, Sam-I-Am.
      --
      Don't tell me to get a life. I'm a gamer; I have LOTS of lives!
    27. Re:This won't work... by chromatic · · Score: 1
      In the meantime I download all books in pdf from pirate sites or p2p, then buy the most useful ones....

      Yeah, right.

      I'm certain that if you download a book and learn something that saves you more than an hour of work, that you think that it's worth $35 to buy the book at full price.

    28. Re:This won't work... by cmeans · · Score: 1

      OK, so A+ isn't just A, but just a little bit more.

    29. Re:This won't work... by Ginnungagap42 · · Score: 1

      I actually ran into this once in Real Life. I worked with an old curmudgeon who was absolutely convinced that programming had been perfected with the advent of FORTRAN, back in 1957. He would not listen to anyone about other programming languages. We had to run f2c a lot when we got his coded up equations. Darn smart scientist, darn stupid programmer.

    30. Re:This won't work... by Anonymous Coward · · Score: 0
      e.g. searching for a character just requires you to compare each 32-bit value to the target, without having to check it isn't a special character that is the first in an escape sequence

      Yeah, but if you're searching for an isolated code point in a Unicode string, you're probably doing something wrong. Pretty much only punctuation would ever makes sense, and everything in ASCII is safe in UTF-8. (and everything in the BMP in UTF-16... or do you regularly localize your apps to Linear A?)

      There is no guarantee that a single code point will map to a single glyph or to a single conceptual unit, even in UTF-32. UTF-32 doesn't prevent you from slicing strings in the middle of a character.
    31. Re:This won't work... by Movi · · Score: 1

      Totally sidestepping the morale aspect of what you've written, i have one thing to say: give me my e-paper first! And i mean a GOOD reader, not the crap that sony makes. No, reading it in a chair half a meter away from my LCD is not comforty. Reading it from a laptop is not comforty either (my back hurts enough already). Once i get a e-paper reader that has acceptable quality i can begin to think about e-books.

      Also, writing a book is not as easy as making a pop song. You can't automate plot like beats.

    32. Re:This won't work... by Anonymous Coward · · Score: 1, Interesting

      IBM did, in a sense. "Programming Language One" was to be the end-all of the languages of the day (50-60s era). It's called PL/I; Multics was written in it (which inspired Unix, which inspired Minix, which inspired Linux, et al).

    33. Re:This won't work... by leenks · · Score: 1

      Fortran is still massively popular in the scientific community, and for some applications on certain platforms fortran outperforms C.

    34. Re:This won't work... by Ginnungagap42 · · Score: 1

      True. But in this instace, that was not the case. He was just stubborn. I have done some FORTRAN as well as COBOL programming back in my IBM 370 days. I prefer the C-based languages (C, C++, ObjectiveC) these days for general purpose and simulation systems programming.

    35. Re:This won't work... by Anonymous Coward · · Score: 0

      Seriously though, why don't we need another programming language? It's not like we only get a finite number of them. Well, it's not possible that we'd have an infinite number of languages. We get only a finite number of languages no matter what.
    36. Re:This won't work... by Workaphobia · · Score: 1

      Version race nothing, I've been watching this language with mild interest for years now. I thought that it reaching version One Point Zero would be as unlikely as DNF getting released. This is the single most surprising headline I've read in a few weeks.

      --
      Evidently, the key to understanding recursion is to begin by understanding recursion. The rest is easy.
    37. Re:This won't work... by compro01 · · Score: 1

      but physical books are obsolete.

      I'll agree heartily with you in terms of reference books ("you can't grep dead trees"), but i still prefer paper books for leisure reading, though that may change as electronic ink displays get cheaper and more widespread.

      --
      upon the advice of my lawyer, i have no sig at this time
    38. Re:This won't work... by sacrilicious · · Score: 4, Funny
      So - that only leaves you the letters H, I, N, O, P (sic!), U, V, W, Y and Z

      I hope someone creates an "O" language. That way, interface bindings for it could be called "O-interfaces", or "O-faces" for short. So when you create a nifty library for the language, publishing it could be known as "showing the world your O-face".

      --
      - First they ignore you, then they laugh at you, then ???, then profit.
    39. Re:This won't work... by Dabido · · Score: 1

      'I'm mostly surprised that noone has thought of a (P)rogramming language. :)'

      Probably prior art ... P is another word for p*ss and how many programmers have had their programs rejected for being as weak as p*ss? So 'P' is what poor programmers write in. [Only to have their programs flushed away!] :-)

      --
      Sure enough, the cow costume was hanging up next to the superhero outfit and sailors uniform. (S,Spud)
    40. Re:This won't work... by msobkow · · Score: 1

      I can't imagine people will stop creating special purpose or concept-hybrid languages as time goes on. If you could treat data structures and communication pipes or backbones as easily as you do lower level constructs, you could begin manipulating them more flexibly. Much as object-oriented concepts cleaned up the package or shared library so that you could begin to see the abstract interfaces and the patterns they represent.

      Each layer of abstraction over the decades has allowed people to see the next layer or two up, or at least to try to see and implement those layers.

      --
      I do not fail; I succeed at finding out what does not work.
    41. Re:This won't work... by whatteaux · · Score: 1

      "I'm mostly surprised that noone has thought of a (P)rogramming language. :)"

      You've never heard of APL ('A' 'P'rogramming 'L'anguage)? But I believe it was IBM, not this "noone" person you speak of, that thought of it.

      Since APL has already been thought of, maybe this "noone" person could call it (P)rogramming (L)anguage / One instead, or PL/I for short. No one will have thought of that, surely.

    42. Re:This won't work... by mrmeval · · Score: 1

      I made the . language so there.

      --
      I'd go on a Vegan diet but the delivery time from Vega is too long. --brownkitty
    43. Re:This won't work... by dheera · · Score: 1

      Neither, you get Microsoft (R) Visual F++.NET (TM)

    44. Re:This won't work... by Malc · · Score: 1

      It's an interesting idea thinking that using Unicode will make an app go faster. I tried it a few years ago. As you probably know, NT is Unicode internally. Programmes written for 8-bit text have every string going in and out of the Win32 API converted back and forth between Unicode and ANSI. Therefore I imagined that making my programme Unicode would result in a speed-up just because it would avoid constant conversions. Wrong! It was slower. I don't remember the reasons why, but my best guess is down to UTF-16 strings requiring twice as much memory as 8-bit ANSI, which is also really wasteful with western languages because every other byte is unused, but must also be zeroed. I imagine UTF-32 to be even worse (i.e. 3 zeroed but otherwise unused bytes per character for western languages). As a programmer though, it is so much easier to work with, especially compared with variable encodings that have variable byte-length characters. One day everything will be UTF16 or UTF32 and life will be easier (yes, I'm aware of surrogates in the former).

    45. Re:This won't work... by Russellkhan · · Score: 1

      Actually, APL stands for A Programming Language, which is possible to parse that way...

      --
      Information doesn't want to be anthropomorphized anymore.
    46. Re:This won't work... by Anonymous Coward · · Score: 0

      UTF-32? Surely you mean UCS-4 no?

    47. Re:This won't work... by TERdON · · Score: 1

      None of them are being referred to as merely "P". But if you had the rest of the comments to my post you would already have known that...

      --
      I have a really elegant proof for Fermat's last theorem. If this sig was only a bit longer...
    48. Re:This won't work... by TERdON · · Score: 2, Insightful

      wasteful with western languages

      I'm not sure which ones you are referring to, except of course English.

      Swedish has ÅÄÖ. Norwegian has ÅÆØ, and so does Danish. Finnish has Ä and Ö. German has ÄÖÜ and ß. French has even more weird characters, including Ç. Spanish has Ñ, Ü and accents, and the list goes on. For really weird characters, check Polish. :) I don't doubt that a few of these are codable in pure ASCII, but for the rest of us, we're happy to be out of the code page choosing problems.

      --
      I have a really elegant proof for Fermat's last theorem. If this sig was only a bit longer...
    49. Re:This won't work... by eugene_roux · · Score: 0, Redundant
      I'm mostly surprised that noone has thought of a (P)rogramming language. :)


      Erm, well...

      It would seem that they actually have... :-)
      --
      Part Time Philosopher, Oft Times Romantic, Full Time Unix Geek
    50. Re:This won't work... by TERdON · · Score: 1

      Please, you're the third one to make that very exact comment. Please return when APL has been referred to as "P".

      --
      I have a really elegant proof for Fermat's last theorem. If this sig was only a bit longer...
    51. Re:This won't work... by LordOfTheNoobs · · Score: 1

      I downloaded your binaries and gunzip'd them, but I cannot seem to find the files upon listing. Perhaps your archive is bad?

      --
      They're there affecting their effect.
    52. Re:This won't work... by bhamlin · · Score: 1

      There actually was already an E, for the Amiga. Link

    53. Re:This won't work... by Short+Circuit · · Score: 1

      If your reason for pirating books is honestly a derivative of your need for an electronic format, may I suggest O'Reilly's Safari service? For $10/month, I get searchable, bookmarkable access to the best programming books I've had the privilege to use.

      Best of all, it works over the web, even over dial-up, so I have access from anywhere I can get to the Internet. It works well on any resolution I happen to use, which is a far cry from PDFs or eBooks. Finally, you can print hard copies of any section of interest.

    54. Re:This won't work... by Flodis · · Score: 1
      So - that only leaves you the letters H, I, N, O, P (sic!), U, V, W, Y and Z if you don't want to have a name clash with another programming language. Technically, M and X are followed by numbers in the previous examples, so you could argue for them as well, and even A (as it has a plus behind the letter)
      Actually, I did some UI programming in V+ on an Adept robot back in 1990, so 'V' is already taken. It was an industrial robot, but was actually pretty cool both hardware and software-wise. It had a mouse, windows and widgets and stuff, and multiple add-in boards for hooking up a video camera and running image recognition. Why not sign up for a course?
    55. Re:This won't work... by Randolpho · · Score: 2, Interesting

      Fortran does actually have some very useful features not found in c or most other languages, especially when doing vector processing; it would be in your best interest to (*gasp*) learn the language rather than run f2c. Also, I would remind you that you compiled c and fortran are link-compatible, so you could create a function-interface specification that would allow you and your curmudgeon to work together, rather than cross-purposes.

      --
      "Times have not become more violent. They have just become more televised."
      -Marilyn Manson
    56. Re:This won't work... by WiseMuse · · Score: 1
    57. Re:This won't work... by Creepy · · Score: 2, Informative

      wow - you missed a couple of C dialects, most certainly because they extended the letter name with a word

      Objective-C and the best programming language in existence, C-Intercal (yeah, yeah - you whitespace lovers can bite me).

      I can't believe you don't know this - it's common knowledge that the letter 'P' was skipped because back in the early 80s Wordstar would use control-P to purge your document with no confirmation screen as opposed to Wordperfect's print, so there was an extreme hatred for the letter from people that used Wordstar at work or school and Wordperfect at home (practically everyone not using Cut-N-Paste on an Apple ][, which was, pretty much everyone). It was such a powerful effect that it practically destroyed the Pascal programming language and its .p extensions and nearly killed the Macintosh, which had standardized on Pascal for its operating system. The stigma of the letter has faded, but many old timers would never use a programming language called P.

    58. Re:This won't work... by just_another_sean · · Score: 1

      Jack Handy? Is that you?

      --
      Creationist Textbook Stickers Declared Unconstitutional by CowboyNeal
    59. Re:This won't work... by Phleg · · Score: 1

      I'm mostly surprised that noone has thought of a (P)rogramming language. :)

      APL

      --
      No comment.
    60. Re:This won't work... by Anonymous Coward · · Score: 0
    61. Re:This won't work... by TERdON · · Score: 0, Redundant

      sigh!

      --
      I have a really elegant proof for Fermat's last theorem. If this sig was only a bit longer...
    62. Re:This won't work... by spitzak · · Score: 1

      Searching UTF-8 works by using string subsearch, which has the advantage that it can also search for any word, not just some glyph. Also you should check real code, I very much doubt anybody searches for any single unicode character other than some ASCII punctuation, which could be searched for in UTF-8 by the normal ASCII search (since it won't match any bytes of a multibyte character).

      UCS-4 (the correct name for UTF-32 because no actual transformation is done) is useful, but mostly as for graphics when actually drawing the glyphs. I recommend that all storage be done in UTF-8, mostly because it is extremely difficult to eliminate all ASCII internally, so this is the only way to make all your string data be the same.

      The glib people apparently though UCS-4 would be useful, that is why wchar_t on Linux is 4 bytes, instead of the 2 used by everybody else, including other Unix implementations. However the main effect is that this means code using wchar_t is incompatable between Windows and Linux, and that nobody on Linux uses it. About the only positive effect I see is that it discourages wchar_t usage.

    63. Re:This won't work... by osu-neko · · Score: 1

      I'm not sure which ones you are referring to, except of course English.

      I'm sure he's referring to western languages, which, like most of the ones you mentioned, are represented perfectly fine in good old 8-bit Latin-1 (not suprising, since the Latin alphabet is one of the things all western languages have in common).

      --
      "Convictions are more dangerous enemies of truth than lies."
    64. Re:This won't work... by julesh · · Score: 1

      D itself conflicts with a pre-existing language design: a replacement for SQL designed by Hugh Darwen and Chris Date.

    65. Re:This won't work... by julesh · · Score: 1

      Most modern processors come with a vector unit that can handle vectors of 32-bit integers, so if you have to handle large quantities of text you can speed certain things up even more by running streaming calculation on the vector unit.

      Yes, but you could speed it up more by using vectors of 8 or 16 bit units.

    66. Re:This won't work... by Surt · · Score: 1

      It's not like we only get a finite number of them.
      Didn't you see that other guy's list? We're almost out of letters already. Using up D for this minor derivative of c++ was just plain wasteful.

      --
      "Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
    67. Re:This won't work... by e_armadillo · · Score: 1

      Sorry, e has been taken for years now, but it isn't exactly a programming language its a Hardware Verification Language. http://www.eetasia.com/ART_8800419943_480400_daed8 03e200606_no.HTM

    68. Re:This won't work... by geezer+nerd · · Score: 1

      I would like to add L6 to the list, though it is now lost in the mists of time. It was another language from Bell Labs back in the 60s, trying to pin down useful linguistic concepts relative to processing linked list data. L6 did not achieve any real-world adoption as far as I know. How many of the other languages listed did achieve real-world use? (names beginning with C excepted from consideration)

    69. Re:This won't work... by __NR_kill · · Score: 1

      I'm mostly surprised that noone has thought of a (P)rogramming language. :) Oh, they thought about this, but they proved P = NP and gave up the P development as the NP promised more candy.
    70. Re:This won't work... by Marcos+Eliziario · · Score: 1

      There was a time when IBM was so convinced of their dominance that they didn't bother to find names for their things. So, if they had a System, they would call it System/, if they had a Database, well, call it DB! Now, things have changed, and they call everything Websphere.

      --
      Your ad could be here!
    71. Re:This won't work... by Lars+T. · · Score: 1

      The language naming started at A, not 0. Our programming languages start with eleven.
      --

      Lars T.

      To the guy who modded me down from perfect to terrible Karma - Apple haters still suck

    72. Re:This won't work... by Anonymous Coward · · Score: 0

      1. If you had actually read TERdON's post, you would see that he included only "single letter (sometimes including some additional nonalphabetic characters)" languages. Neither of the two languages that you mentioned fit these qualifications.

      2. That Wordstar thing (the naming reluctance, not the control-P operational difference) isn't and wasn't "common knowledge" (and I was around back then), and even if it were, this is like 20 years later, so things like that are no longer applicable. Also, there is a big difference (at least one keypress) between P and ^P. (I used DEC notation for control-P to show you that I really was around back then.) Typing of control characters, I wonder if anyone has named languages with single-character names based on control characters or other non-alphanumeric characters. (Back in the 1970s, I once wrote a TECO-like text editor named "%", but a text editor isn't a language.)

    73. Re:This won't work... by lekikui · · Score: 1

      I'm definitely a fan of paper books for general reading, and I'll even extend that to reference books. I just find it easier to skim through a paper book to find something, although I think having an electronic copy of a book on hand when I don't have time for that could be useful.

      --
      "Lisp ... made me aware that software could be close to executable mathematics." - L. Peter Deutsch
    74. Re:This won't work... by Creepy · · Score: 1

      wow - that was a joke, I was entirely kidding. Only a masochistic child could love C-INTERCAL (with a syntax that requires commands like PLEASE DO, but if you use PLEASE too much, the compiler thinks you're groveling). I filled in a bunch of power words to make the post ooze sarcasm (e.g. common knowledge) and people still think I was serious.

      I wasn't even serious about the C stuff, I figured as much - it was a segue into C-INTERCAL but they are dialects of a one letter name language (C). I actually do know a non-listed 1 letter name, an old BBS scripting language called K! (but if it still exists, I'd be shocked).

    75. Re:This won't work... by Durandal64 · · Score: 1

      You've pretty much got it. Not only do Unicode strings require more memory, but they also require more time to step through. For an 1-byte character, a compare routine has to step through 8 bits in the worst case. For a 2-byte character (such as a Unicode-16 character), you need to step through 16 bits in the worst case. Now, if you're dealing largely with just English-language characters, compares won't be that big a problem since, as you say, the higher-order bits will remain largely unused. It'll be reading the strings and writing them to memory that'll catch you.

    76. Re:This won't work... by Anonymous Coward · · Score: 0

      > Not only do Unicode strings require more memory, but they also require more time to step through.
      > For an 1-byte character, a compare routine has to step through 8 bits in the worst case.
      > For a 2-byte character (such as a Unicode-16 character), you need to step through 16 bits in the worst case.

      Except comparisons between characters are not done in a bitwise fashion; compare instructions do something like subtraction, comparing the entire quantity at once. You don't step through 8 or 16 bits at all.

      What's more, if the word size is 32 bits, you can end up doing MORE work to compare 8-bit characters because they must be loaded in 32-bit chunks and shifted into place to align with word boundaries, depending on the processor architecture.

      So with a fixed-width Unicode encoding you don't lose any efficiency, but you do with a variable-length encoding.

    77. Re:This won't work... by meiao · · Score: 1
      Men have Perl: a series of unintelligible grunts.
      - Tablizer (95088)
  2. D is surprisingly good. by FishWithAHammer · · Score: 3, Informative

    I'm looking at using it via GDC for my next project. For people who use C/C++ regularly, this is something you ought to look into.

    It's not a toy language. If you're a C++ programmer, you'll be almost immediately functional in the language. And you can call C and C++ libraries seamlessly. It's pretty sweet.

    --
    "You can either have software quality or you can have pointer arithmetic, but you cannot have both at the same time."
    1. Re:D is surprisingly good. by matrixise · · Score: 5, Informative

      from http://digitalmars.com/d/interfaceToC.html

      D does not provide an interface to C++. Since D, however, interfaces directly to C, it can interface directly to C++ code if it is declared as having C linkage.

      D class objects are incompatible with C++ class objects.

    2. Re:D is surprisingly good. by Brandybuck · · Score: 2, Informative

      And you can call C and C++ libraries seamlessly.

      Really? Not according to their FAQ. C yes. C++ no. Otherwise I would be in the process of switching over as we speak.

      --
      Don't blame me, I didn't vote for either of them!
    3. Re:D is surprisingly good. by Anonymous Coward · · Score: 0

      Perhaps the most powerful part of C++ was the development of the STL. That is what changed C++ from just being C with fully defined classes to being a very powerful language. I wonder if there is anything in D that would break the simplicity of STL (yeah, yeah, I know I'm going to get flamed by some for this statement). If D can use a ported STL as simply, I would change over in a minute.

      Of course I am very annoyed that the author used the name "D Programming Language." I thought everyone had already decided that it was going to be the "P Programming Language" followed by next iteration called the "L Programming Language." Well C++ sort of broke that rule, but I am still annoyed!

    4. Re:D is surprisingly good. by canuck57 · · Score: 1

      I'm looking at using it via GDC for my next project. For people who use C/C++ regularly, this is something you ought to look into.

      This is a (repeat) commercial plug for a language that has tried before and never got accepted. If you want a more modern language, write Java, if you want machine performance speeds then C/C++. If you don't know pointers, then you don't know how the machine works. I would never use a doctor that didn't know how my body worked.

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

      This seems to crop every few years for the last few decades...

    5. Re:D is surprisingly good. by Geoffreyerffoeg · · Score: 2, Insightful

      If you don't know pointers, then you don't know how the machine works. I would never use a doctor that didn't know how my body worked.

      Yes, but last time I went to the doctor he didn't grab a hand pump and start pushing my blood around.

      And when was the last time C let you manually push items onto the stack?

    6. Re:D is surprisingly good. by Profane+MuthaFucka · · Score: 1

      Well you knew it would be controversial to say that STL is simple, so why did you say it?

      --
      Fascism trolls keeping me up every night. When I starts a preachin', he HITS ME WITH HIS REICH!
    7. Re:D is surprisingly good. by eluusive · · Score: 3, Informative
    8. Re:D is surprisingly good. by Lord+Ender · · Score: 0
      If you don't know pointers, then you don't know how the machine works. I would never use a doctor that didn't know how my body worked.

      Have you ever asked a GP physician about microbiology? They know surprisingly little. Doctors work at a higher level and get a lot done without knowing the lower level details.
      --
      A slashdotter who didn't build his own computer is like a Jedi who didn't build his own lightsaber.
    9. Re:D is surprisingly good. by metamatic · · Score: 1
      Well you knew it would be controversial to say that STL is simple, so why did you say it?

      Comedy value?

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    10. Re:D is surprisingly good. by mgiuca · · Score: 1
      D class objects are incompatible with C++ class objects.

      That's the same for Objective C though. In general, all object oriented languages' objects / class interfaces are incompatible with each other, but they can still communicate through raw functions (in this case, the common framework of C).

      (Though this refers to languages compiled to native code. .NET objects are all compatible with each other, and Java VM classes are too I'm sure).

    11. Re:D is surprisingly good. by scotch · · Score: 1
      Yeah, never say anything controversial!!!!

      PS: the STL is simple.

      PPS: love your work, PMF

      --
      XML causes global warming.
    12. Re:D is surprisingly good. by FishWithAHammer · · Score: 1

      I'm looking at D because Java sucks.

      --
      "You can either have software quality or you can have pointer arithmetic, but you cannot have both at the same time."
    13. Re:D is surprisingly good. by larry+bagina · · Score: 1

      most doctors spend their time writing prescriptions for drugs a patient has seen advertised on tv. If I need a prescription for Fukitall, that's fine. If I have a couple odd symptoms that aren't explained by a 5 minutes of googling, that's not fine.

      --
      Do you even lift?

      These aren't the 'roids you're looking for.

    14. Re:D is surprisingly good. by Anonymous Coward · · Score: 0

      > If you want a more modern language, write Java, if you want machine performance speeds then C/C++.

      You must be joking. Of course it's a bit difficult for a new language to gain momentum, but rarely an expert compiler writer creates a better language for free and does it right.

      D has more high level features than any of the languages you mention. It simply excels at meta programming. Currently the availability of libraries favors Java and C++, but they both suffer from poor productivity (e.g. design by contract). C++ is an awful beast from the eternal deeps of hell. Sure it has rocket like performance and all, but it's so twisted and difficult to understand you'll end up creating slower implementations than in Java.

    15. Re:D is surprisingly good. by reconn · · Score: 1

      I've no personal experience using D, but indie-gaming darling Kenta Cho has been using it for years to make some of the most acclaimed free games on the net.

      --
      Everything that was once directly lived has receded into a representation. -debord
    16. Re:D is surprisingly good. by shutdown+-p+now · · Score: 1

      > And when was the last time C let you manually push items onto the stack? A long time ago.

    17. Re:D is surprisingly good. by Profane+MuthaFucka · · Score: 1

      I was kind of looking for reasons why you think the STL is simple. Maybe conceptually it's simple, but in practice it's amazingly complicated. It's hard enough to master that a lot of people stay away from it.

      --
      Fascism trolls keeping me up every night. When I starts a preachin', he HITS ME WITH HIS REICH!
    18. Re:D is surprisingly good. by ChrisNSauls · · Score: 1

      Well, "dynamic" (variable-length) arrays, associative arrays (which are actually implemented as fast hash trees, in case anyone was curious), and slices account for a good deal of what STL has been used for. Being able to use strings as cases to a switch statement, while not strictly speaking a collections concept, also alleviates some use cases. A foreach statement, which is itself applicable to classes/structs (via the opApply overload). I really don't know exactly what to point out without knowing exactly what features you need, though. :) Even things like stacks can be implemented as arrays in D (or very simple class/struct wrappers around an array if you need the security) rather simply.

    19. Re:D is surprisingly good. by Geoffreyerffoeg · · Score: 1

      "Allocating variables in the stack frame of the current function" is not "pushing items onto the stack". It can't be popped off the stack; it can't be placed there in preparation for a function call. In fact, the article linked says not to use alloca in the middle of a function -- if you could truly PUSH and POP, it would be perfectly fine to do something vaguely like push(2); printf("%d");.

    20. Re:D is surprisingly good. by xenocide2 · · Score: 1

      Well, we use the gcc inline asm facilities often enough where I work. It doesn't complain at least.

      --
      I Browse at +4 Flamebait

      Open Source Sysadmin

    21. Re:D is surprisingly good. by scotch · · Score: 1
      For me, the fact that the STL is conceptually simple makes it easy to use. Sure, sometimes, there are some ugly warts for some things you want to do, but I find that the concepts laid out by the STL are cohesive and make sense, and the occasional syntactic hoops one must jump through are not much bother. Plus, extending, adapting, or emulating the STL as required is pretty easy and natural. If the STL containers don't work for me, I can write new ones that behave similarly and leverage the iterators and algorithms of the STL.

      In short, simple container and algorithm usage is dead simple, and more complex things are possible. Everything more or less fits together. Makes sense to me, I can't say the same for other container/algorithm libraries I've used.

      Regards.

      --
      XML causes global warming.
  3. My goodness. by Lord+Kano · · Score: 0, Offtopic

    Someone is making sweet love to the bandwidth. I'm downloading at less than 6KBps.

    --
    "Hi. This is my friend, Jack Shit, and you don't know him." - Lord Kano
  4. Weird writeup: by Per+Abrahamsen · · Score: 3, Insightful

    From the compared to C/C++ list:

            * native code speed

    As opposed to C/C++.

            * extremely fast compilation times

    Point granted (compared with most C++ compilers).

            * garbage collection (although you can manage your own memory if you want)

    Point granted, even though C and C++ arguably have optional garbage collection as well (if you link to the right library).

            * OOP - by reference only, easy initialization, always virtual

    Only value semantic? Meyer had to accept that value semantic was useful, and add it to Eiffel eventually, and C# added it over Java.

    And no way to specify that a function will always be the one specific. Good luck doing any kind of reasoning there.

    Bragging about missing features, that are essential to many tasks.

            * cleaner template metaprogramming syntax, more powerful templates, as well

    *More* powerful templates? The usual complaint is that C++ templates are too powerful (a Turing-equivalent compile time language).

            * built-in dynamic and associative arrays, array slicing

    Not exactly a recommendation that the core language apparently is so weak that these can't be put into libraries.

            * versioning (no preprocessor madness)

    I'm guessing he meant variants here, the preprocessor is often used for variants, rarely for versioning.

            * link-compatibility with C

    Which C and C++ of course lacks?

            * nested functions

    Point.

            * class delegates / function pointers

    Obviously both C and C++ have function pointers.

            * module system

    More preprecessor replacement here.

    The C#/Java list:

            * similar syntax

    But totally different from C++?

            * No virtual machine or interpreter

    You can compile Java and C# to native code as well, so this is just another case of bragging about a missing feature.

            * built-in unit testing and design-by-contract

    I'm a C++ programmer, and this is by far the most interesting aspect of the D language (and of Eiffel before that). Don't know why it should be in the Java/C# list.

    1. Re:Weird writeup: by 91degrees · · Score: 3, Informative

      Couple of points:

      * native code speed

      I think this is a response to criticisms from C programmers about most modern languages, rather than a benefit over C.

      Not exactly a recommendation that the core language apparently is so weak that these can't be put into libraries.

      Some of this is useful enough to be built in. stl and the like are pretty handy but sometimes it feels a bit of a kludge. Plus, built-in allows better optimistations for specific cases.

      Obviously both C and C++ have function pointers.

      Yes, and the syntax is horrible. D makes this a lot nicer.

    2. Re:Weird writeup: by Anonymous Coward · · Score: 0

      *More* powerful templates? The usual complaint is that C++ templates are too powerful (a Turing-equivalent compile time language).

      The usual complaint that I hear is that C++ templates are unwieldy, clumsy, and produce incomprehensible compiler or linker error messages. If they can provide a meta-programing facility without the confusing mess of C++ templates then I'm all for it.

    3. Re:Weird writeup: by Anonymous Coward · · Score: 1, Interesting

      * nested functions

      Point. Why do so many people care about nested functions? I really don't see the use except for people who want to write Pascal-like girly-man code. It isn't as if your stack doesn't treat non-nested functions as nested functions in some implementations (as in you'll return to the instruction one after where you started). Is this about people who want to share data between functions but are afraid to use classes, references, or pointers; people who don't want to share information between parts of a function; or people are afraid of the normal forms of polymorphism (all options depending upon the implementation of course)? The answer: use references, write your functions shorter, overload your functions, and stop crying like a baby.
    4. Re:Weird writeup: by Mike+McTernan · · Score: 1

      > >* versioning (no preprocessor madness)
      >
      > I'm guessing he meant variants here, the preprocessor is often
      > used for variants, rarely for versioning.

      I does look like variants to me, but appears to be called versioning - check this:

      http://www.digitalmars.com/d/version.html

      --
      -- Mike
    5. Re:Weird writeup: by Anonymous Coward · · Score: 0

      The most important change wasn't mentioned in the writeup. From the comparison chart, D has built in array bounds checking. The lack of automatic bounds checking in C and C++ single-handedly accounts for more than 50% of all security holes. If everyone dropped C and C++ and switched to something with automatic bounds checking our software would be far, far more secure.

    6. Re:Weird writeup: by IamTheRealMike · · Score: 1

      The Win32 API makes heavy use of macros for versioning, so I do not believe you can classify it as "rare". Maybe it's rare on UNIX but that's a failing, not a strength.

    7. Re:Weird writeup: by Anonymous Coward · · Score: 1, Funny

      the core language apparently is so weak that these can't be put into libraries...

      LMAO! And, as expected, we see your true colors. C++ FANBOY OFFENDED. FILM AT 11:00!

    8. Re:Weird writeup: by Anonymous Coward · · Score: 0

      A lot of bounds checking can be added by the compiler. So it's not so much about dropping the language, as improving the tools. I've seen various gcc patches for C array checking and the backend already looks to have the capabilities in there:

      http://www.lrde.epita.fr/~akim/compil/doc/bounds-c hecking.html

      Borland CodeGuard also did array bounds checking for C a long time ago.

    9. Re:Weird writeup: by Anonymous Coward · · Score: 0

      It was already solved in the early 90s by the STL. Additionally, it is easier to use for things like text input (which crackers use to break in). In fact, with the ways that STL has been optimized, the programmer would probably have about the same speed with the STL constructs as with most functions they use with standard arrays. Programmers who still use arrays directly had better be doing loops or high speed systems programming. If not, then they should be prepared to be beaten without remorse.

    10. Re:Weird writeup: by Sterling+Christensen · · Score: 1

      * built-in dynamic and associative arrays, array slicing

      Not exactly a recommendation that the core language apparently is so weak that these can't be put into libraries. Show me a C implementation and I'm show you a D inplementation - the syntax is almost identical sans preprocessor. It certainly wasn't done that way for any core language weakness.

      * versioning (no preprocessor madness)

      I'm guessing he meant variants here, the preprocessor is often used for variants, rarely for versioning. Nope, no variants. There's actually a version keyword, for "versioning" (conditional compilation).
    11. Re:Weird writeup: by Anonymous Coward · · Score: 0
      I haven't even looked at D yet, but...

      *More* powerful templates? The usual complaint is that C++ templates are too powerful (a Turing-equivalent compile time language). Sure they are supposedly "Turing-equivalent", but leveraging that is a nightmare. The complaint about C++ templates isn't that they are expressive, it is the hoops you have to jump through to take advantage of this and how error prone and obscure it is.

      * built-in dynamic and associative arrays, array slicing

      Not exactly a recommendation that the core language apparently is so weak that these can't be put into libraries. This implies that you think the C/C++ handle of arrays is good?!
    12. Re:Weird writeup: by WalterBright · · Score: 1

      D OOP features are based on classes, which are reference types. Using value types to implement OOP is fraught with problems, not the least which is the slicing problem. D enables user defined value types with structs. Structs are value types, and do not have OOP features like inheritance and virtual functions.

      The trouble with C++ templates is not that they are too powerful, it is that they are not powerful enough for what they are being used for. C++ templates were never designed for metaprogramming. D templates, however, are designed for metaprogramming and it shows. Simple support for tuples, for example, dramatically reduces the implementation size (sometimes by over 90%) of C++ TMP examples.

      The debate over whether arrays etc. should be in the core or the library is a long one that has played out in comp.lang.c++.moderated, I refer you to that if you're interested. For this discussion, suffice to say that it is both simplistic and incorrect to say that the existence of core arrays means that such cannot be built with libraries.

      Delegates are not just function pointers, they are a pair consisting of a context pointer and a function pointer. The closest thing C++ has to it are member function pointers, which are far more difficult to work with.

      D has no VM. This is far more than just whether it is interpreted, jit compiled, or statically compiled. VMs are an abstraction away from the machine, an abstraction that interferes with writing system level code.

    13. Re:Weird writeup: by rbarreira · · Score: 1
      Point granted, even though C and C++ arguably have optional garbage collection as well (if you link to the right library).

      I'm not going to check any sources, but aren't those garbage collectors assuming that everything in memory is a pointer? That's a horribly hackish approach, which is of course due to the languages not being designed for garbage collection...

      (I might be wrong, I didn't check the state of the art in C garbage collectors before posting)
      --

      The AACS key is NOT 0xF606EEFD628B1CA427BEA93A9CA9773F
    14. Re:Weird writeup: by Foolhardy · · Score: 1
      Delegates are not just function pointers, they are a pair consisting of a context pointer and a function pointer. The closest thing C++ has to it are member function pointers, which are far more difficult to work with.
      So, you stick the member function pointer with a pointer to an object of that class together to create a delegate class. See boost::function plus std::bind1st or the boost::lambda library as examples.
    15. Re:Weird writeup: by WalterBright · · Score: 1

      Sure, but why not do it right to begin with?

    16. Re:Weird writeup: by donglekey · · Score: 2, Interesting

      This strikes me as the thoughts of someone who hasn't given D a good look. I have been using it recently and it is phenomenal. It is a breath of fresh air. It is not that it has many of these features over C/C++, it is that it cleans out the enormous amounts of headache inducing things about these languages while retaining what Java/C# lose. Native code speeds. No VM. Trivial Integration with C.

    17. Re:Weird writeup: by Anonymous Coward · · Score: 0

      There are C++ compilers with exact garbage collection. It requires support from the compiler though, but the language treats pointers distinctly enough to make it possible. Now Forth on the other hand...

    18. Re:Weird writeup: by newt0311 · · Score: 1

      actually no bounds checking is very useful in C code because C has no concept of variable length structures. For example, In PostgreSQL, with the return structure having a variable length, there is a length marker up front and then the data in inlined right after that. Forced bounds checking would make this process incredibally more complicated. If a language implements bounds checking, it needs to go all the way and manage memory completely. If not, you will end up with a screwed up mess when you try to implement anything complex in it.

    19. Re:Weird writeup: by Anonymous Coward · · Score: 0

      The debate over whether arrays etc. should be in the core or the library is a long one that has played out in comp.lang.c++.moderated, I refer you to that if you're interested.

      If you do spend any time in comp.lang.c++.moderated or comp.lang.c++, you'll find Mr Bright dropping in on all kinds of C++ discussions plugging D over C++. I don't know why he doesn't get moderated out or booted from CLCM more often; his D-apologetics are rarely on-topic. Mr Bright is clearly bright (ha ha) and knows much about C++, but I for one get sick of his constant, thinly veiled advertisement and advocacy for D in those forums.

    20. Re:Weird writeup: by Foolhardy · · Score: 1

      Right to begin with? What's wrong with C++'s implementation?

      Pointers to members are useful in their own right. A pointer to member plus a pointer to the base object provides all the functionality of function and field delegates. One of C++'s greatest strengths is that the base language isn't weighted down by functionality that can be implemented in libraries, e.g. text strings. The less redundant pieces that go into a language, the better: libraries are much better for multiple alternatives.

    21. Re:Weird writeup: by WalterBright · · Score: 1
      What's wrong with C++'s implementation?



      Whenever one uses pointers to members, one always winds up pairing it with a context pointer (this) anyway. Why not eliminate the extra step, and pair it to begin with, and obviate the need for a complex library component? Furthermore, delegates have an untyped context pointer - meaning that the context pointer can be to anything, only the function signature must match. This means that delegates can be nested functions, too. The various C++ attempts to do this require a lot of complexity and overloaded functions.



      Pointers to members are useful in their own right.



      By themselves, I don't agree. I've almost never seen any use for them in isolation.



      A pointer to member plus a pointer to the base object provides all the functionality of function and field delegates.



      No, only a subset, as unlike a true delegate, the pointer to member pair is bound to the class type. A delegate is bound to only the function signature.



      One of C++'s greatest strengths is that the base language isn't weighted down by functionality that can be implemented in libraries, e.g. text strings. The less redundant pieces that go into a language, the better: libraries are much better for multiple alternatives.



      That's an odd thing to say about a language that is, by far, the most complex core language ever devised. BTW, you can devise your own string class in D just as well (or better) than you can in C++. But few find any point in doing so. In any case, C++ does have core text strings and core arrays. They just don't work very well. I also haven't seen any C++ proposals for how to do a string literal in a user defined manner.

    22. Re:Weird writeup: by DonVictor · · Score: 1

      I think you misread the purpose of the lists in the article. I think the C/C++ list is not "as opposed to", it's more like "you might be interested in". For example, the speed argument is not "D is fast but C++ is slow", but rather, "you might be working in C++ for speed reasons, D has that too."

      I also think part of what makes D so great (IMHO) is that it has learned from years of C++ and Java design and user experience. Some things C++ does well, but some things had consequences that didn't show until years later, especially interactions between C++ features. For what its worth, I'm a big fan of Bjarne's work, but pioneers always make some assumptions that don't pan out, and C++ is stuck with these now. Also, C++ taught the systems programming and mainstream folks about OOP and to think beyond C, which then allowed languages like Java and D to take off. In order to bring these academic ideas into the mainstream, Bjarne had to maintain the old C language assumptions.

      Tacking a GC library onto a project using a library is messy. The most common one (Boehm et al) does not work cleanly with classes unless you use their base class above all your designs. No other C++ library does this (but I think they have a custom STL and string class on the Boehm site), so you are forced into a mixed GC + manual situation if you don't code all your own C++ libraries. It works well with C style coding, but if I was writing an OpenGL library in C++, do I require people to link with libgc? They will often not be willing to, since it's kind of disruptive. Plus it's just hard to trust it frankly, since the compiler writers can easily break it with new optimizations (i.e. stack layout changes) and I think they have in the past. Maybe they won't any more (since its gained some visibility) but do you really know for sure?

      Templates and TMP are a good thing if they are cleanly done, have a look at D's version. Templates are thought to be too powerful because we don't like to mix power and sloppiness, and meta programming happened after templates were built in C++.

      As for associative arrays and strings they can be done in libraries, but D's approach has a lot of benefits. For one thing, using the STL in C++ causes compile speed and error message clarity issues; many optimizations are available when the strings are language rather than library. Also, a lot of syntax becomes ugly in C++, for instance ("abc" + string("def")) doesn't work. In D you can also write a 'switch' using strings as case constants, for instance. Unicode is also much cleaner than in C++. Probably partly because C++ predates the most modern unicode designs.

      Delegates are nicer than function pointers, and allow some really cool stuff. Search for "lazy", "opApply" and "foreach" on the D page.

      Also, with Java, I converted a Java program into D and it went amazingly smoothly. It worked almost as soon as the syntax errors were fixed, which was mostly minor stuff. It was only a little algorithmic program; I imagine if you use a lot of Java libraries it requires more work.

      As related to the unit test stuff, there are interesting semantics concerning invariants used in classes, and how input and output contracts are inherited from parent to subclass.

    23. Re:Weird writeup: by Anonymous Coward · · Score: 0

      Who says that the comparison was saying that those were capabilities that C++ doesn't have? I read the comparisons as "For those of you with C++ experience, here are analogous features between D and C/C++." I don't think anyone was boasting that those were features D has that C/C++ doesn't.

    24. Re:Weird writeup: by arkanes · · Score: 2, Insightful

      It's worth pointing out that the lack of core strings and vectors means that every C++ library more than 5 years old has it's own implementation of them, which means hooking libraries together means you get to waste time, memory, and performance on shuffling between almost identical string and array implementations. Multiple implementations of things like strings and basic vectors is a weakness, not a strength. The ability to provide specialized implementations of these is a strength, and D has that.

    25. Re:Weird writeup: by marcosdumay · · Score: 1

      I'm looking into D (or Eifel, undecided until now) to start a project that I'm already postponning for 2 years... So, I can answer some questions.

      "* native code speed
      As opposed to C/C++."

      No, like C/C++. The summary doesn't help, anyway, I doubt that claim, because it lacks pointer arithimetics. Don't get me wrong, normaly laking it is a nice feature, but it doesn't help making fast programs.

      "Point granted, even though C and C++ arguably have optional garbage collection as well (if you link to the right library)."

      That's not enough. In C/C++ you can't count on the garbage collector being there, and that makes all the diference.

      "*More* powerful templates? The usual complaint is that C++ templates are too powerful (a Turing-equivalent compile time language)."

      Their site claims a less powerfull template system, I bet the summary is wrong.

      "Not exactly a recommendation that the core language apparently is so weak that these can't be put into libraries."

      Being builting makes it so clearer than dealing with a library. Also, there are new operators defined exclusively for them. Anyway, they seem to be coded at the core library, not exactly builtin (the summary doesn't help again).

      "I'm guessing he meant variants here, the preprocessor is often used for variants, rarely for versioning."

      Yep, that is how they call variants at their site too.

      "More preprecessor replacement here."

      Yep, D deosn't have a preprocessor, what is a huge gain since the compiler knows about everything that is on your program.

      "But totally different from C++?"

      Similar, not equal. It not totally different from C/C++ either, just different. Who wrote that sumary?

      D is an interesting language, that tries to get the best of lots of languages, but automatic memory management, design by contract and builtin test units are the most important features (also lack of macros if you come from C/C++). I don't know yet how those help on practice, but it seems to be a good language.

    26. Re:Weird writeup: by Anonymous Coward · · Score: 0

      > Why do so many people care about nested functions

      Here's a box of gold stars -- go stick one on yourself every time you think of making a wikipedia link so you don't have to actually subject us to it. We're programmers here.

      Lexical scope is the reason for nesting functions. All you people who scream about how OOP is overrated have a point, but only when you have langauges that actually supports closures.

    27. Re:Weird writeup: by FooBarWidget · · Score: 1
      You can compile Java and C# to native code as well, so this is just another case of bragging about a missing feature.

      What? You can natively compile C#? Since when? Care to give a link? I've asked many forums and everybody tells me it's not possible.
    28. Re:Weird writeup: by ericthughes · · Score: 0

      CLR for C# 2.0 claims JIT native compile. See MSDN on the CLR.

    29. Re:Weird writeup: by Anonymous Coward · · Score: 0

      A comparison looks at similarities ("pare" -> equal). If it claimed to "contrast" C++ features with D features, then yes, one would expect a list of differences.

      Many of the features on those lists are there precisely because they'd be early questions that a potential C/C++/Java convert would ask. "Will D be slower? Can I still use templates?". As such, I think they're well chosen.

    30. Re:Weird writeup: by Foolhardy · · Score: 1

      Whenever one uses pointers to members, one always winds up pairing it with a context pointer (this) anyway.

      That's like saying that whenever one uses a function, one always winds up combining it with arguments: therefore function pointers are useless alone, they should always be bound with arguments when created. A pointer-to-member provides one more level of indirection than a delegate by making the target object a parameter. This parameter can be bound with an auxiliary class. C++ provides the support to make such classes behave very much like first class types.

      Pointers to members are useful in their own right.By themselves, I don't agree. I've almost never seen any use for them in isolation.

      I've found them useful for providing access to a private field or function of my choosing to a second class that will use it on multiple objects, i.e. an alternative to friend. The best part is that the target class can dispense different member pointers to provide different functionality, without modifying the calling class. An object can bottle an operation to be executed on an entire list of its peers, executed by a third party that needn't be privy to that operation.

      No, only a subset, as unlike a true delegate, the pointer to member pair is bound to the class type. A delegate is bound to only the function signature.

      A simple pointer to member is bound to the class type. However, any good C++ delegate class will not make the target class a part of its type: every compiler provides a way store a generic pointer to member, regardless of which class its a member of. As long as the delegate class guarantees that the class type and member pointer types match at runtime, it can safely cast to a generic pointer to member type. Users of the delegate class needn't worry about the details. The only remaining type information is the function signature.

      This means that delegates can be nested functions, too. The various C++ attempts to do this require a lot of complexity and overloaded functions.

      Any good delegate implementation will support static functions. It would be nice to have directly nested functions, but you can still have functions nested in classes nested in functions.

      The only function I can think of overloading on a delegate class is the parenthesis operator to make invocation pretty. If comparison would be useful, the default binary comparison operator would be sufficient. I once created a Sink class that implements single argument delegates in 48 text lines. It only overloads operator (). I wouldn't call that complex. And it isn't hard to use:

      struct C
      {
      int _x;
      C(int x) : _x(x) {}
      void f(int y) {cout << _x + y << endl;}
      };

      void f2(int y) {cout << y << endl;}

      void g()
      {
      C c(6);
      Sink<int> d(&c, &C::f); //a member function
      d(5);
      Sink<int> d2(&f2); //a non-member function
      d2(11);
      }

      Granted, functions with variable arguments will require more work on the part of the library writer, but as a user of the class you don't have to worry about that.

      That's an odd thing to say about a language that is, by far, the most complex core language ever devised.

      Complexity isn't the same thing as implementing things in the core language that could be done in a library. Besides, there are definitely other language specs massive in size compared to C++'s: for example, Common LISP's specification is quite massive (about 1300 pages; there's a joke that Scheme LISP's entire language spec fits inside just the INDEX to index to Guy Steele's "Common Lisp: the Language, 2nd Edition"), and Perl certa

    31. Re:Weird writeup: by be-fan · · Score: 1

      Bounds-checking in C is complicated to implement (read the limitations imposed on code on the page you referenced), and slow too. Bounds-checking a language with proper arrays is very cheap --- a simple limit check that can be issued in parallel with the load from the array. On a modern superscaler CPU (which has tons of idle issue slots most of the time), it costs you 2-3% even in tight loops. In comparison, deal with bounds-checking in a language with pointers requires inserting bits of padding everywhere and checking their validity on each pointer access. It's much more expensive both in space and in time.

      --
      A deep unwavering belief is a sure sign you're missing something...
    32. Re:Weird writeup: by Anonymous Coward · · Score: 0

      > As long as the delegate class guarantees that the class type and member pointer types match
      > at runtime, it can safely cast to a generic pointer to member type. Users of the delegate class
      > needn't worry about the details. The only remaining type information is the function signature.

      Oh, no. I you just indetified a problem with C++'s implementation that D solves. Not quite so simple... Not to worry you can always find a C++ library that will do this in a typesafe way.

    33. Re:Weird writeup: by ChrisNSauls · · Score: 1

      Something which may be of interest. Benjamin Shropshire recently posted on the D newsgroup with a parser generator he'd written using D template metaprogramming. The parser generator itself (one source file) can be viewed at http://www.webpages.uidaho.edu/~shro8822/dparse.d and a complete usage example at http://www.webpages.uidaho.edu/~shro8822/exp_gramm er.d.

  5. java native code compilation by Nutty_Irishman · · Score: 2, Informative

    All other considerations aside, runtime speed really should be a justification as a bonus to Java. Java isn't that much slower if you actually take the time to compile it to native code first. Using something like a JIT compiler http://en.wikipedia.org/wiki/Just-in-time_compilat ion can greatly increase the speed of your code and put it close in line with C++. I would certainly consider D if both 1 and 2 were better than Java.

    1. Re:java native code compilation by Decaff · · Score: 4, Informative

      Java isn't that much slower if you actually take the time to compile it to native code first. Using something like a JIT compiler http://en.wikipedia.org/wiki/Just-in-time_compilat ion can greatly increase the speed of your code and put it close in line with C++.

      This is a bit of an old myth. Almost all Java is run as native code these days, even on VMs, and is mostly pretty close to C++ speed. Benchmarks that show Java as significantly slower than C++ usually result from not allowing the VM enough time to perform native code translation of time-critical code. Java has moved away from JIT compilation (as against the later optimisation of HotSpot) because it led to long start-up times - you had to wait for code to be compiled to native before it ran. Now Java usually starts up as interpreted, with the translation to native code happening later on, in the background.

      Where C, C++ and D win out over Java in terms of performance is when you need programs that have to start up fast, run fast, but only for short periods (a few seconds).

    2. Re:java native code compilation by Anonymous+Brave+Guy · · Score: 1

      Where C, C++ and D win out over Java in terms of performance is when you need programs that have to start up fast, run fast, but only for short periods (a few seconds).

      Or where you're doing serious, high-performance maths and not just running simple benchmarks. For most apps, any differences here are such a small proportion of the total run-time that it's irrelevant if Java is slower in this area. But for heavyweight modelling applications, I'm afraid Java's not really in the game; those little limitations/performance penalties for safety just multiply up too fast.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    3. Re:java native code compilation by vistic · · Score: 1

      As of what version have they been moving away from JIT?

      I've been noticing significantly longer start-up times for Java over the years.

      But then again, now that I think about it, this is usually just on the first run per session, so maybe the JVM has gotten slower to start-up over the years, and after that it resides in memory in the background.

      I'm feeling too lazy to check this out and see if it's only the first run of a Java program that's slow, or if it's slow even if I then run another program.

      Still, yeah... the programs themselves have gotten zippier over the years.

    4. Re:java native code compilation by TheRaven64 · · Score: 1

      I don't know if it was implemented, but one of the planned features for .NET was install-time compiling. It wouldn't be too hard to implement this in a JVM. If you already cache the native code on disk somewhere (which you really ought to; it's just a waste of cycles to compile it every time you run it), then you can just generate these caches when you install the application.

      --
      I am TheRaven on Soylent News
    5. Re:java native code compilation by coredog64 · · Score: 1

      As of .NET 2.0, ngen (.NET assemblies to native code) is actually useful. For it to be useful under Java Sun would have to figure out some way to create an assembly cache that could be used by all installed versions of Java -- something I don't see happening anytime soon.

    6. Re:java native code compilation by Anonymous Coward · · Score: 0

      > If you already cache the native code on disk somewhere (which you really ought to; it's just a waste of cycles to compile it every time you run it)

      Give the man a cigar!

      He's just discovered the reason compilers were invented in the first place. :)

    7. Re:java native code compilation by matrixhax0r · · Score: 1

      Wait, really? Where can I find out more about this?

      --
      If it's no on fire, it's a hardware problem.
    8. Re:java native code compilation by Anonymous Coward · · Score: 0

      So why doesn't anyone write commercial, retail-box-release games in Java? They usually have 10 seconds of load time anyway, so it's not the compilation time.

    9. Re:java native code compilation by metamatic · · Score: 1

      I've been noticing significantly longer start-up times for Java over the years.

      Really? On my systems, Java 5 is enormously faster than 1.4 and earlier at starting up the JVM. It actually makes it bearable to write command line utilities in Java.

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    10. Re:java native code compilation by metamatic · · Score: 1
      So why doesn't anyone write commercial, retail-box-release games in Java?

      They do.

      The You Don't Know Jack series was the first I was aware of, and that was back in the 90s. A recent one is Chrome .

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    11. Re:java native code compilation by Anonymous Coward · · Score: 0

      only people who are not expert in C/C++ claims that java have the same speed.
      take 1 specialist in C++ and one in java.. tell then to do a program, and see who is the winner.

      The only benchmark on the web that says java is fast, is from people who are specialists in java, but is a begginer C++ programmer. just see how they uses in their benchmark, a StringBuffer in java and a array of chars in c... and says: StringBuffer is faster... daaaaaa

      take programs like azureus, very nice and works well, but eats a lot of memory and cpu. ( 30% of my cpu just to handle a few sockets?! ), hey i can handle 40000 connections in C++ , can you do that in java ?

    12. Re:java native code compilation by vistic · · Score: 1

      In hindsight I think I was referring to the compiler not the virtual machine, taking longer to start up.

      But still the virtual machine is a pain when it starts up... sometimes I'll be browsing a website, and suddenly it seems my computer is freezing or crashing... but then I realize, no, it's just Java starting up and some person decided to put a stupid Java applet on their page so their name can look like it's on fire or something... or show me the time.

    13. Re:java native code compilation by Decaff · · Score: 1

      But for heavyweight modelling applications, I'm afraid Java's not really in the game; those little limitations/performance penalties for safety just multiply up too fast.

      This is yet another old myth. IBM demonstrated long ago that with the right coding, Java could match FORTRAN speeds (with the right VM technology). There are few penalties for safety, as the code analysis performed by the optimising native code translator usually allows array bound checks (for example) to be optimised out. You have to code so as to allow such optimisations to be done, but this is certainly possible.

      I use Java for just such modelling.

    14. Re:java native code compilation by Decaff · · Score: 1

      It wouldn't be too hard to implement this in a JVM.

      There seems to be a persistent view that once-only compiling is a good thing. It is for some apps (when you need very small binaries that start up quickly) but it a large number of cases, it isn't. It is far better to have apps continually profiled and re-optimised as they run - there is a potential for much better performance than the for once-only compiled apps.

    15. Re:java native code compilation by Decaff · · Score: 1

      > If you already cache the native code on disk somewhere (which you really ought to; it's just a waste of cycles to compile it every time you run it)

      Give the man a cigar!

      He's just discovered the reason compilers were invented in the first place. :)


      Firstly, this really isn't a waste of cycles to compile - it is done in a background thread, and only 'hotspot' code is compiled, which is normally a small fraction of the entire app. Concern over the small amount of processing involved is excessive.

      Secondly, this is not why compilers where invented. The on-the-fly-with-optimisation compilation approach (not JIT) was only researched in the 90s with the invention of the Self language - it is recent.

    16. Re:java native code compilation by Decaff · · Score: 1

      only people who are not expert in C/C++ claims that java have the same speed.
      take 1 specialist in C++ and one in java.. tell then to do a program, and see who is the winner.


      Not true. I have been using C (and Fortran) since the 70s and C++ since the 80s. I regularly benchmark Java against C++. Java does occasionally come out as the winner.

      The only benchmark on the web that says java is fast, is from people who are specialists in java, but is a begginer C++ programmer.

      Not true. There have been many benchmarks showing that Java has equivalent to C/C++ speed for many intensive numerical algoriths and test suites (such as Linpack). The people who implement the benchmarks are certainly not C++ beginners.

      take programs like azureus, very nice and works well, but eats a lot of memory and cpu. ( 30% of my cpu just to handle a few sockets?! ), hey i can handle 40000 connections in C++ , can you do that in java?

      Yes, of course you can. The clustered cacheing product for Java called Coherence can easily handle over 65,500 concurrent connections on a single server. That is close to the theoretical maximum possible.

    17. Re:java native code compilation by TheRaven64 · · Score: 1
      I don't dispute this; there are a lot of optimisations that a C compiler, for example, simply can't do. It is, however, a mistake to duplicate effort. I would have the installer do a first-approximation pass at the code to turn it into native, but not too heavily optimised, code. This would be faster than interpreted code, but slower than a properly optimised version. Each time the program is run, it would then collect profiling information and an idle-priority thread would recompile it based on this. Once you are in a state where the successive profile and optimisation runs aren't changing the code much, you would just keep this code.

      Of course, changes to the input data might make some optimisations invalid, so you would keep collecting the profiling data to check if this is the case.

      --
      I am TheRaven on Soylent News
    18. Re:java native code compilation by Rich0 · · Score: 1

      What they really need to do is have a standard for caching the optimized code. You run a Java app for 10 minutes, and it finally starts to really shine. Then you toss all your hard work and go back to bytecode on the next run. If they just cached the native code it would start out fast the next time, and still get faster.

      Most gui-oriented apps run for a long time. But, most command-line apps don't. What was the longest grep you ever ran? Ditto for sed/awk/etc. Lots of apps get spawned and die just as fast - this is where python works great and java just doesn't.

    19. Re:java native code compilation by gnuLNX · · Score: 1

      And this is yet another myth. Java is NEVER used by any seriou scientist. Why? It's to slow. When your application is expected to run for weeks/months/years at a time every clock cycle matters.

      Java is perfectly fine and well suited for what Java is good for. It is not now, nor will it ever be, a scientific programming language. That isn't a slight against Java. Christ you can probably write games in Java now..and the speed would be fine. But sometimes you need every last bit of speed possible...you know like the function were you have to write inline assembly to maximize usage of the SSE3 registers?

      I guess I just tire of the C++/Java speed debate. In the real world if you need speed you use C/C++ combine with inline assembly. That's just the way it is.

      --
      what?
    20. Re:java native code compilation by Decaff · · Score: 1

      Each time the program is run, it would then collect profiling information and an idle-priority thread would recompile it based on this. Once you are in a state where the successive profile and optimisation runs aren't changing the code much, you would just keep this code.

      My impression is that this would be a lot of effort for little gain. JVMs already have great performance, and don't take long to optimise code. Furthermore, they can even do this in memory-limited situations (HotSpot will run even for mobile Java). And, as you say, the runtime situation can change. I am willing to have my mind changed, but for now, I just can't see any real advantage.

    21. Re:java native code compilation by metamatic · · Score: 1

      Yeah, crapplets still take a long time to start up. I'm not sure why that is, given that the VM startup time has been reduced so much. Maybe it's something to do with the whole plugin mechanism.

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    22. Re:java native code compilation by julesh · · Score: 1

      I've been noticing significantly longer start-up times for Java over the years.

      The main driver for this is increasing complexity of the class library. The java.lang.Object class now depends directly or indirectly on over 200 other classes. These classes must all be loaded and initialized before any user code can run.

    23. Re:java native code compilation by Mr.+McGibby · · Score: 1

      Other than those two? Speak to the point, not the analogy. The vast majority of games are written in C/C++. Why is that? Why isn't Java being used?

      --
      Mad Software: Rantings on Developing So
    24. Re:java native code compilation by Anonymous Coward · · Score: 0

      That was a joke, actually...

      But since you mention it, the point is this: compiling unchanged code more than once on a given platform is a waste of cycles. No matter that it's a small waste in this case.

      As to your second point - the approach may be new, but the concept of compiling, optimizing, and caching code so it can be loaded and run more quickly later goes all the way back to FORTRAN. "Caching the native code on disk" is what a compiler does, that's the essence of the joke.

      By taking the comparison seriously, you've killed it. Way to go, champ!

    25. Re:java native code compilation by metamatic · · Score: 1

      There are lots of games other than those two written in Java.

      I imagine that most games are still written in C/C++ for a number of reasons:

      1. C/C++ is what the developers know.

      2. Toolkits and engines (RenderWare, Havok, PS2 dev kit etc) are mostly built for C/C++.

      3. Java's suitability for games is a somewhat recent development, and it'll take a while to catch on.

      4. Myths that Java can't run fast enough for games.

      Lisp has the same problems. Hence although it has been used for games and real-time programs for years, it's still a minority language for the problem area. (Random examples of mainstream games written in Lisp: Jak and Daxter series on PS2, "Abuse" for PC. Random examples of real time systems written in Lisp: NASA Deep Space One control software, AT&T digital exchange control software.) ((Yes, I used to work for a Lisp vendor.))

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    26. Re:java native code compilation by Lars+T. · · Score: 1

      And this is yet another myth. Java is NEVER used by any seriou scientist. Why? It's to slow. Nor do serious scientists use C or even C++, because they'd rather have auto-vectorizing with FORTRAN.
      --

      Lars T.

      To the guy who modded me down from perfect to terrible Karma - Apple haters still suck

    27. Re:java native code compilation by rblum · · Score: 1

      As a game developer, let me add to this:

      1. There is a minimal difference between Java and C++, but C++ is *still* faster. Yes, even with the newest JVMs. Even a 1% speed difference is critical - in most AAA games, we require 100% of the CPU, not 99%. That's obviously not a point for puzzle games, arcade remakes, etc.

      And no, it's not a myth. I've done (and keep doing) extensive performance tests. What, you think we *like* C++???

      2. That is the exact reason why those toolkits are written in C/C++.

      3. .NET now has XNA - a framework for making games. Java doesn't really - so I'd expect more .NET than Java games

      4. Lisp has the problem that you can't hire enough competent developers. Naughty Dog abandoned Lisp for the later J&D games because they couldn't find anybody to keep it running.

      5. Both Lisp and Java are very viable at a higher level - namely, game logic. For various reasons - memory constraints being one of them, and of course ease of integration - LUA is winning there, though.

      In short, don't expect any games that push the envelope to be written in Java anytime soon.

    28. Re:java native code compilation by metamatic · · Score: 1

      Well, yes, there are always going to be the envelope-pushing games that need the extra few percent speed of C or C++. However, that doesn't explain why the other 95% of games don't make more use of other languages. Given that you can write something like Quake 2 in Java and have it run plenty fast enough on today's common hardware, that covers the speed needs of a hell of a lot of games.

      Perhaps if game developers made more use of better languages, the frequency of games in development hell would be reduced. Perhaps we'd also lower development costs for the non-envelope-pushing games and get more inventive original games.

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    29. Re:java native code compilation by rblum · · Score: 1

      Pretty much most of what's happening on game consoles *is* envelope pushing. That leaves the PC and the mobile market.

      The mobile phone market is almost entirely Java, but not the right platform for something of Quake2 complexity. I've got no clue about the handheld (DS/PSP) market, but I'd expect most of them are C++ because nobody ever ported a JVM.

      As for the PC market: You are aware that more and more games have at least layers of high level code in them, right? WoW has LUA for the user interaction. Civ IV has large parts written in Python.

      I don't think it'll do much for dev hell, though - misestimation stays misestimation, no matter what the language. (And you haven't accounted for art & design with a language change). It *will* make working on games more pleasant as you spend less time on housekeeping tasks and more on the game

    30. Re:java native code compilation by metamatic · · Score: 1
      Pretty much most of what's happening on game consoles *is* envelope pushing.

      Yeah, but again that still leaves a big chunk of the market. Katamari Damacy, DDR, FPSs, RPGs, Guitar Hero, 3D action platformers like Jak & Daxter, Ratchet & Clank, Sly Cooper... they're all quite doable in Java. Not everything is Metal Gear Solid and Gran Turismo.

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
  6. E's taken! by headkase · · Score: 1

    Hold your horses, E is already used in a quite good Amiga Language.

    --
    Shh.
    1. Re:E's taken! by nogginthenog · · Score: 1

      I remember programming in E many years ago on the Amiga. A nice OO language, a bit of a mixture of c & pascal. A cool feature was inline assembler, but the best was the speed of compilation. On a 7Mhz 68000 Amiga the compiler really flew.

  7. Re:Erm how is this better.. by Nasarius · · Score: 2, Insightful

    Try using .NET for systems programming. Or projects (I've made several thousand dollars from one so far) that must be portable to NT4, 2K/XP without requiring your clients to install extra junk on every computer, etc. Contrary to what Microsoft may want you to believe, .NET is not the solution to all the world's problems.

    --
    LOAD "SIG",8,1
  8. Cheers for D! by RAMMS+EIN · · Score: 1

    Cheers for D, and happy new year to Walter and all the rest! As much as the D community is often derided for their sometimes aggressive marketing, D is actually a programming language that can run with the best of them.

    --
    Please correct me if I got my facts wrong.
  9. GUI for D language by twkrimm · · Score: 1

    I am hoping that D is or soon will be a good alternative to C#.net and Mono. What is the preferred GUI environment for D? I was watching the D forums during the first half of 2006 but I could never post any questions to the D forums so I gave up. It looks like I gave up too soon. Does anybody know why I could not post to the D forums?

    1. Re:GUI for D language by kihjin · · Score: 1
      Here are some options:

      • DUI - GTK+ bindings
      • DWT - Port of the Standard Widget Toolkit


      D can access routines in a C library, so any C GUI toolkit can be used from within D.
      --
      This slashdot-related signature is a stub. You can help kihjin by expanding it.
    2. Re:GUI for D language by Skylinux · · Score: 1

      Looks like it's called DUI and it works on Linux and Windows.

      DUI is D GUI

      --
      Everyone who buys Wild Hunt will receive 16 specially prepared DLCs absolutely for free, regardless of platform.
    3. Re:GUI for D language by Zerathdune · · Score: 1
      D can access routines in a C library, so any C GUI toolkit can be used from within D.
      Then why is DUI even necessary to use GTK+ in D? What am I missing?
      --
      No single raindrop believes that it is responsible for the storm.
    4. Re:GUI for D language by kihjin · · Score: 1

      Technically it isn't. You could bind all the functions yourself.

      DUI and other "wrapper/binder" libraries bring functions (such as those in GTK+, OpenGL, SDL) into D's scope so you may use them just as you would in C. bound.

      --
      This slashdot-related signature is a stub. You can help kihjin by expanding it.
    5. Re:GUI for D language by AchilleTalon · · Score: 1
      What a silly question! It's like if you were asking: Hey guys, which communication protocol is the preferred one for D?

      Did you ever programmed for real? Or you are just using some kind of tool which is generating the code for you?

      --
      Achille Talon
      Hop!
    6. Re:GUI for D language by Tanuki64 · · Score: 1

      I wish there were Qt bindings from Trolltech. I would switch to D at once.

    7. Re:GUI for D language by twkrimm · · Score: 1

      I am not a Troll and I have 20+ years programming experience and I do not want to go back to the old OS/2 and Windows 9x GUI design days. I want a Rapid GUI Development Environment similar to Borland C++ Builder or Visual Studio C#.net. I want to draw the widgets on the screen, click the widget and poof you are editing the widget_click function. Quick, simple, do not have to worry about the details unless you are doing something special. I can spend my time doing the stuff that I enjoy, the stuff behind the GUI that does something useful. I am expressing what I feel is a "killer app" or "killer tool" that can make D and Linux shine even more. Yes I know about the GUI tools and libraries discussed in the above forums. By-the-way, no one mentioned "entice".

  10. I give it a "F" by Anonymous Coward · · Score: 0

    I don't see D as an advancement in programming languages. I give it a "F"

    1. Re:I give it a "F" by Anonymous Coward · · Score: 0

      Trying for a pun there, were we? Enjoy your mediocrity.

  11. Re:Erm how is this better.. by TheGavster · · Score: 2, Informative

    What, exactly, is the benefit of the .Net VM? There is only one full implementation of .Net (the MS one), and it runs on a single platform (Windows on x86). You might as well build native x86 code linked against Windows libraries for all the portability you have. And even if you're going to bother implementing the VM across a bunch of platforms, why not implement a standard library across a bunch of platforms and link native executables against that?

    --
    "Because Science" is one step from "Because old book". Try "Because of my experiment testing my falsifiable assertion".
  12. Slashdot doesn't read full archives by LostCluster · · Score: 1

    Most Slashdot community comments in these articles have been offered on feature X or spec Y without reading through the extensive D newsgroup archives

    You must be new here.

    1. Re:Slashdot doesn't read full archives by JamesTRexx · · Score: 1

      Actually, that means he isn't new here. :-P

      --
      home
  13. Because the ones we have suck? by Dion · · Score: 1, Insightful

    C/C++ are primitive languages barely above the level of Assembler macros.

    Java is a bit nicer than C++ but it just can't perform at the level of C (how many OS'es are written in Java?)

    perl/ruby/python are closer to being good languages, but they still don't perform like a compiled language.

    I don't know if D gives the features of Perl with the speed of C, but it's certainly a step in the right direction.

    --
    -- To dream a dream is grand, but to live it is divine. -- Leto ][
    1. Re:Because the ones we have suck? by jyoull · · Score: 1
      Java is a bit nicer than C++ but it just can't perform at the level of C (how many OS'es are written in Java?)

      What with Java being an interpreted language and all, how would ya write an OS in Java? I guess you've have to have an OS-OS that runs the interpreter and provides all the low-level stuff that... what? oh. Yeah. turtles all the way down, isn't it? I guess if ya had that, we could write a Java OS and then find out.

      Anyway just suggestin' that performance doesn't necessarily explain the "why isn't the OS written in java" question. A doesn't follow B. Socrates is not mortal, etc.
    2. Re:Because the ones we have suck? by StrawberryFrog · · Score: 1

      how many OS'es are written in Java?

      How many OS'es are written in Python?
      Neither Java, ruby, perl nor python attempt be appropriate languages for writing OS'es. This doesn't make them good or bad. Other factors might.

      I don't know if D gives the features of Perl with the speed of C

      Hell, I hope not. Perl might collapse into a black hole if any more features are piled into it

      --

      My Karma: ran over your Dogma
      StrawberryFrog

    3. Re:Because the ones we have suck? by Eli+Gottlieb · · Score: 1

      (how many OS'es are written in Java?)
      You hit the nail on the head. Until D and to my knowledge, Object Pascal was the highest-level language you could write bare-metal/embedded code in (think C++ without the bullshit). Perl and Python can have as many features and perform as fast as you like, but I've never seen anyone compile them down to machine code and have them schedule threads on a bare x86.

    4. Re:Because the ones we have suck? by TheRaven64 · · Score: 3, Informative
      There is no such thing as an interpreted language. There are languages, and there are interpreters and compilers. Lisp, for example, can be both interpreted and compiled (Scheme is usually interpreted and Common Lisp is usually compiled, but there are exceptions). Tcc can both compile and interpret C code. Java can be compiled by something like gcj or interpreted by a JVM. If you compile Java you lose some of the features; the JVM bytecode format is designed so that it is easy for automated tools to reason about. At load-time, the JVM will parse the class files and check that they do not violate the Java security model; this is theoretically possible with compiled code, but much harder.

      The Squeak runtime for Smalltalk is written in Smalltalk. There is a smallish subset of Smalltalk used to write the basic functionality, which is compiled to native code. This then supports the whole language. The same model is, I believe, used for JNode, an operating system written in Java...

      --
      I am TheRaven on Soylent News
    5. Re:Because the ones we have suck? by FlyingGuy · · Score: 1

      And Object Pascal STILL kicks ass!

      --
      Hey KID! Yeah you, get the fuck off my lawn!
    6. Re:Because the ones we have suck? by jyoull · · Score: 2, Interesting
      There is no such thing as an interpreted language. There are languages, and there are interpreters and compilers.


      Are you really well acquainted with gcj? I'm sorry, but I don't get how the end result or even the stuff going into it (and the required inputs, like making some explicit calls that would never be required in Java) can be called Java anymore.

      the point I didn't make well was that when a language has been designed to execute inside a containing environment (the JRE or whatever facsimile thereof) you can't just up and erase that... without emulating all the stuff that was supposed to be alive in that environment. Taking a look at the gcj's to-do list and all the stuff that isn't yet supported should be enough to show you not only that this is not a trivial task, but to suggest that perhaps it's not a useful task, and I say that knowing that people have worked very hard on the project.

      Maybe it makes sense for some resource-constrained settings like embedded systems, but there i've used Java straight up, satisfactorily. Granted, these are not life-critical systems I've built, but rather than compiling Java - or trying to - the better answer is to use a more appropriate language in those circumstances.
    7. Re:Because the ones we have suck? by timeOday · · Score: 1
      I don't know if D gives the features of Perl with the speed of C, but it's certainly a step in the right direction.
      Not if it doesn't guarantee type safety. Undefined behavior is the devil. It's time to migrate away from C/C++ for complex applications, especially anything touching the network (or any other untrusted user).
    8. Re:Because the ones we have suck? by Eli+Gottlieb · · Score: 1

      YA damn right! Free Pascal Compiler for the win!

    9. Re:Because the ones we have suck? by iluvcapra · · Score: 1
      There is no such thing as an interpreted language. There are languages, and there are interpreters and compilers.

      An interesting point, theoretically, but if you write a compiler for a language that has an eval() function (basically any dynamic interpreted language) you would have to include a complete compiler for the language in the language's runtime environment. This also applies to any language that does call- or pass-by-name (since this is just an application of eval() ).

      You could compile such programs, but the runtime infrastructure (on any Intel/PowerPC type machine) would be huge, with dispatch tables serialized into the binary to allow relinking names back to memory locations, and a JIT compiler to allow eval to work. The call stack would probably have to be abstracted, and the thing just starts looking like a platform-optimized interpreter, with the added requirement that you have to compile your scripts before running them. (It actually starts looking like Objective-C, JUST KIDDING! :P )

      This applies to current hardware arch, but if you built a CPU that, say, ran Java natively, or at least handled strings of arbitrary length as quickly as an x86 handles a UInt32, then an compiler of a dynamic language begins to make more sense.

      --
      Don't blame me, I voted for Baltar.
    10. Re:Because the ones we have suck? by thephotoman · · Score: 1

      Well, as an amusing point of comment, Unununium is a language they're trying to write in Python. Of course, it's not exactly functional at this time, and the way it handles time is a convoluted fix to the 2038 problem that is rendered pointless by the advent of 64-bit processing and the subsequent doubling of the possible length of the value returned by time_t(), but it does exist.

      Of course, they're still waiting on a Python compiler, or at the very least, a Python-to-C translator, which may not ever actually be realized.

      That said, I'm a fan of arcane knowledge, so I might just pick up PDP-8 assembly for the hell of it.

      --
      Haec merda tauri est. Ceterum censeo Carthaginem esse delendam.
    11. Re:Because the ones we have suck? by thephotoman · · Score: 4, Funny

      Wait...C++ without the bullshit? That takes away all of C++!

      --
      Haec merda tauri est. Ceterum censeo Carthaginem esse delendam.
    12. Re:Because the ones we have suck? by murr · · Score: 1

      An interesting point, theoretically, but if you write a compiler for a language that has an eval() function (basically any dynamic interpreted language) you would have to include a complete compiler for the language in the language's runtime environment. This also applies to any language that does call- or pass-by-name (since this is just an application of eval() ).


      Correct regarding eval(), but call-by-name can easily be implemented by thunks.
    13. Re:Because the ones we have suck? by Anpheus · · Score: 1

      You may consider this an ignorant comment, and if so I apologize, but I was quite certain that Python supported bignum. Shouldn't that obviate the need for a fix to time_t?

    14. Re:Because the ones we have suck? by FishWithAHammer · · Score: 1
      There is no such thing as an interpreted language.


      Wrong.
      --
      "You can either have software quality or you can have pointer arithmetic, but you cannot have both at the same time."
    15. Re:Because the ones we have suck? by donglekey · · Score: 2, Informative

      D is garbage collected, has no vm, enables access to assembly language, access to direct memory management, and has trivial access to C libraries.

      Those techniques are definitely good if they work for what you are doing, and believe me I have wanted them to work for me, but the reality is that D enables things that those approaches don't have while retaining the ability to work and not worry about the language getting in your way.

    16. Re:Because the ones we have suck? by larry+bagina · · Score: 1

      how would ya write an OS in Java? I guess you've have to have an OS-OS that runs the interpreter and provides all the low-level stuff that...

      Some ARM processors have support for native Java bytecode.

      --
      Do you even lift?

      These aren't the 'roids you're looking for.

    17. Re:Because the ones we have suck? by GimliGloin · · Score: 1

      Not Soooo Fast... http://www.powerbasic.com/

      I used to use the Blitz Basic Compiler for the Commodore 64 but I couldn't find a link on that one....

      Wait... this -> http://en.wikipedia.org/wiki/Blitz_BASIC is close...

      GSG

    18. Re:Because the ones we have suck? by Decaff · · Score: 1

      Java can be compiled by something like gcj or interpreted by a JVM.

      Almost all Java on JVMs is now compiled. A better way to put things is that Java can be largely pre-compiled by something like gcj, or compiled at run-time by a JVM.

    19. Re:Because the ones we have suck? by Anonymous Coward · · Score: 0

      The overhead is not really that huge, JIT compilers are well established technology by now. It's practically impossible to make eval() of a dynamically built string as efficient as compiled code, but that is not the issue. Even if the eval() of your language allows access to local variables in surrounding contexts (eg. the Common Lisp eval() can only access global names), you don't need to do every access through a symbol table -- you only need to take care that variables are dumped to the symbol table from machine registers when entering the eval() function. Entire modules that don't use eval() can be compiled as if there was no eval() at all.

      As for your point about string comparison... the usual trick is to use "unique" strings, ie. look them up in a symbol table once, when converting code from a string to an internal data structure, and from that point on you only need to do pointer comparisons to check if two "strings" are the same.

    20. Re:Because the ones we have suck? by LizardKing · · Score: 1

      I don't know if D gives the features of Perl with the speed of C, but it's certainly a step in the right direction.

      Well I for one hope that D doesn't give the features of Perl. Perl is the C++ of scripting languages - far too many idioms for doing the same thing, poor support for Object Oriented Programming and a complex grammar. The virtues of C include its relative simplicity, which means a competent programmer can understand the entire language and standard library without having to resort to a reference manual all the time. A language like Objective C shows that OOP support could be elegantly added to C, unlike the over-engineered mess of C++ which evolved in a haphazard manner, making some poor design decisions along the way. While I haven't looked deeply at D yet I'm encouraged by the design decisions, such as "virtual methods by default", which suggest the elssons of C++ have been learned by some people at least.

    21. Re:Because the ones we have suck? by AndroidCat · · Score: 1

      That's not a language, that's an implementation of a language.

      --
      One line blog. I hear that they're called Twitters now.
    22. Re:Because the ones we have suck? by jeremyp · · Score: 1

      You could argue that there are languages, interpreters and compilers and all three are always required. For instance, Sun's implementation of Java is compiled into bytecode and then interpreted by a JVM (ignoring JIT for the moment). If I compile a 386 executable with gcc, it is compiled to x86 machine code and then interpreted by a CPU. The CPU is probably a RISC machine that interprets 386 instrutions to some other instruction set and then interprets that in hardware.

      --
      All I want is a secure system where it's easy to do anything I want. Is that too much to ask ~~ Randall Munroe
    23. Re:Because the ones we have suck? by Teilo · · Score: 1

      Um, the "doubling" of the value returned by time_t()? That would be 33 bits, not 64.

      Let's just say with 64 bit time, the sun will have gone super-nova before we need to worry about the end of the Unix era.

      Ok, so we all have our Homer moments.

      --
      Mir tut es leid, Menschen daß Einfältigfehlersuchenbaumfolgendenaffen sind.
    24. Re:Because the ones we have suck? by Anonymous Coward · · Score: 0

      I think his point was that it actually is a language that one implementation happens to interpret. That it doesn't have to be interpreted. Its the same thing as saying C, C++, and x86 assem. are interpreted languages....most (if not all) implementations are not interpreted, but they could be...the language itself can't determine interpreted or not.

    25. Re:Because the ones we have suck? by TheRaven64 · · Score: 1
      Thank you, that's a very good way of expressing it. These days, the x86 instruction set is really a VM. All modern x86 chips will split x86 instructions into a a set of ops, and Core-series chips even then combine some sets of ops into a single internal instruction. Some emulators (I'm not sure if any hardware does this, but I wouldn't be surprised) perform lazy-evaluation of some of the side-effects of x86 instructions (e.g. setting various condition bits), because there is no point in calculating them if they are clobbered by the next instruction without being checked.

      These days, there are CPUs available (a lot of ARM chips, especially the ones found in mobile phones) that include a subset of the JVM's instruction set in their native ISA, meaning that the difference between Java bytecode and 'native' code is not large.

      --
      I am TheRaven on Soylent News
    26. Re:Because the ones we have suck? by Glock27 · · Score: 1
      Are you really well acquainted with gcj? I'm sorry, but I don't get how the end result or even the stuff going into it (and the required inputs, like making some explicit calls that would never be required in Java) can be called Java anymore.

      I'm fairly well acquainted with gcj, and in fact it compiles a fair amount of standard Java without problems. There is also the Jet compiler which is ahead-of-time and fully compliant.

      So, it's certainly possible to do a good ahead-of-time Java compiler. Whether Java is desirable as the "next big general purpose language" is another question, of course.

      D is attractive if viewed as a superior C++.

      Maybe it makes sense for some resource-constrained settings like embedded systems, but there i've used Java straight up, satisfactorily. Granted, these are not life-critical systems I've built, but rather than compiling Java - or trying to - the better answer is to use a more appropriate language in those circumstances.

      There is a very big sweet spot for a language that's approachable, powerful, productive and efficient. With the advent of performance/Watt thinking, it makes no sense to get efficient processors and then throw away that efficiency on slow software. Of course, there are also applications where raw speed is very important; real time apps, simulations, games and scientific programs.

      C++ is widely viewed as less than desirable. It's good to have better, more modern alternatives going forward. Another interesting looking language is Dylan, though quite different in many ways.

      --
      Galileo: "The Earth revolves around the Sun!"
      Score: -1 100% Flamebait
    27. Re:Because the ones we have suck? by be-fan · · Score: 1

      Uh, it's really not that complicated. You can very easily compile a language with EVAL (like Lisp). Just include the compiler in the runtime, and call into the compiler to generate machine code from program fragments when necessary. This technique has been used more than once to write kernels in Lisp.

      --
      A deep unwavering belief is a sure sign you're missing something...
    28. Re:Because the ones we have suck? by be-fan · · Score: 1

      C and C++ are actually a very large step away from assembly language, and are probably closer to Java than to assembly. The memory model of C is moderately close to assembly, though it hides registers and memory ordering instructions. However, the execution model is completely different. It abstracts branches, function calls, the runtime stack, not to mention things like branch hints, etc.

      Once you've got C, you've got functions, function (direct and indirect), variables, conditionals, loops, types, type-checking, variables, etc. What does Java add on top of that? Classes, more type safety, another abstraction over indirect function calls (method calls), and some synactical suger like foreach (in recent versions). Put another way: its a lot more work to write a C to assembly compiler than modify a C compiler to compile Java (standard library aside).

      --
      A deep unwavering belief is a sure sign you're missing something...
    29. Re:Because the ones we have suck? by thephotoman · · Score: 1

      I didn't say that the value of time_t() would be doubled, I said its length would be doubled, partially due to the fact that it would mean that the clock wouldn't expire until such time as the world is over.

      And your point about how long it would take to exhaust such a scale is only partially correct: the sun will not go supernova. It's nowhere near big enough.

      --
      Haec merda tauri est. Ceterum censeo Carthaginem esse delendam.
    30. Re:Because the ones we have suck? by Teilo · · Score: 1

      I apologize for misreading your comment about time_t, but I'm still right about the supernova part:

      The current maximum value of time_t is about 68 years. 68(2^32) = 292,057,776,130 years.

      --
      Mir tut es leid, Menschen daß Einfältigfehlersuchenbaumfolgendenaffen sind.
    31. Re:Because the ones we have suck? by owlstead · · Score: 1

      "Java is a bit nicer than C++ but it just can't perform at the level of C (how many OS'es are written in Java?)"

      http://www.jnode.org/
      http://en.wikipedia.org/wiki/JavaOS
      http://lejos.sourceforge.net/

      I admit, JavaOS is dead and lejos is for Lego bricks, so that leaves jnode.org. Note that there are already many OS's out there, and end-users typically don't care what kind of language the OS is written in. Most bricks of operating systems are found in C/C++ libraries, with nice GNU or BSD licenses.

    32. Re:Because the ones we have suck? by Hamilton+Lovecraft · · Score: 1

      Keep working on that reading comprehension thing.

      --
      step 3: god dammit, it doesn't work
    33. Re:Because the ones we have suck? by heinousjay · · Score: 1

      I think the point was that the sun can't go supernova, not that you made an error in time scales.

      --
      Slashdot - where whining about luck is the new way to make the world you want.
    34. Re:Because the ones we have suck? by Teilo · · Score: 1

      And my point was the time scale involved, not whether the sun is physically capable of going supernova.

      Slashdot: the biggest bunch of nitpickers (myself included) on planet earth.

      --
      Mir tut es leid, Menschen daß Einfältigfehlersuchenbaumfolgendenaffen sind.
    35. Re:Because the ones we have suck? by ink · · Score: 1
      Tomcat does this with the com.sun.tools.javac class hierarchy in Java, for compiling JSP pages.

      Of course, nobody has ever accused the Java runtime of being dainty...

      --
      The wheel is turning, but the hamster is dead.
  14. Re:Another 'Toy' Programming Language by Anonymous Coward · · Score: 0

    I'll stick to languages that have at least a professional following, in use by real software engineers (that is, engineers who can legally call themselves engineers), not the run of the mill code monkeys.

    Me too, PHP is da bomb!
  15. Currently learning D by kihjin · · Score: 5, Informative
    Note: I've been programming in C/C++ for four years.

    I took it upon myself to learn D not more than a few weeks ago. A classmate introduced me to the language last spring.

    While I'm still learning D, it has some notable features:

    • auto keyword for inferred type declaration
    • lazy keyword for evaluation
    • delegates are like function pointers, but cooler. Literal statements can be passed as variables, and aren't evaluated until the delegate is called.
    • scope(exit|failure|success), specify a block of exit code
    • in/out/inout function keywords, offer readable code for determining what a parameter in a function is designed for.
    • get/set methods automatically become a property (accessed like a public variable)
    • foreach, foreach_reverse, container iteration
    • with statement, C++'s using on a object-level

    Of course one may argue that none of this is necessary and could be made independent of the language itself. My belief is that would increase the complexity of coding in D.

    If you're interested in D you should visit http://www.dsource.org/. There are some interesting projects such as Derelict (collection of C game bindings) and Bud (make and SCons replacement).
    --
    This slashdot-related signature is a stub. You can help kihjin by expanding it.
    1. Re:Currently learning D by iluvcapra · · Score: 1

      Intersting. How are public interfaces to private implementations declared, and how are mixins written?

      On dsource.org I can't find any examples of public headers into libraries.

      --
      Don't blame me, I voted for Baltar.
    2. Re:Currently learning D by Mr.Radar · · Score: 2, Informative

      The compiler generates header files from source files with the -H option. It can decide what code is necessary and what code isn't.

      As for mixins, you can get the full scoop and some simple examples in the language spec, specifically the portion on Mixins.

      --
      What if this signature were clever?
    3. Re:Currently learning D by iluvcapra · · Score: 1

      Thanks, looks like good stuff. Now I just have to wait a year for the Cocoa bindings! :D

      --
      Don't blame me, I voted for Baltar.
    4. Re:Currently learning D by ChrisNSauls · · Score: 1

      Actually I recall someone starting a "Docoa" project quite some while back. Honestly don't know the status of the library as I haven't had a personal need for it, but Google might help locate it.

  16. It looks like a step down by Anonymous Coward · · Score: 4, Funny

    After working so hard to get from C to C++, I don't see why I would settle for D. My next programming language is going to be B- or better.

    1. Re:It looks like a step down by 4D6963 · · Score: 2, Funny

      After working so hard to get from C to C++, I don't see why I would settle for D

      I'd gladly have my girlfriend to go from C to D, but I admit there's nothing I would love more than DD.

      Edit : yeah I know, quit telling me that I must be a liar, I don't have a girlfriend, WHO CARES?!?
      Edit #2 : What? You can't edit your comments on Slashdot? So how am I doing that, jerk?

      --
      You just got troll'd!
  17. More old junk repackaged to look new by Anonymous Coward · · Score: 0

    This language is simply not worth noting. It's a simple evolutionary step over c/c++ but still suffers in many ways from their flaws.

    Seriously, how is a language like this newsworthy? It does nothing for taking us forward in the world of development languages. There are numerous languages already far more sophisticated and closer to the future that D could ever hope to be. D is simply a sad attempt at holding onto the past.

    *snore*

    1. Re:More old junk repackaged to look new by canuck57 · · Score: 1

      This language is simply not worth noting. It's a simple evolutionary step over c/c++ but still suffers in many ways from their flaws.

      While I agree with you in that D is not worth noting, I don't believe any language is per say deficient. It is the user of the language who is deficient or needs to make the evolutionary step. The languages are driven by logic and overhead, not yet mastered by the carbon unit who instructs it. The silicon unit has it dead right, logically. I don't see this argument going away until we develop a superior carbon based, self learning computers. Silicon is dumb like nails (1 or 0) and it is the fault of the carbon unit for not grasping where the deficiency is.

      Our predisposed biases and illogical behavior are why the logic of silicon fails, every time.

    2. Re:More old junk repackaged to look new by rbarreira · · Score: 2, Insightful

      Hey hey, calm down. Are you sitting now? Ok, read:

      Programming languages are to intended to be used by humans.

      --

      The AACS key is NOT 0xF606EEFD628B1CA427BEA93A9CA9773F
    3. Re:More old junk repackaged to look new by eluusive · · Score: 1

      Yes, speak authoritatively to an unknown audience when you haven't read the spec or used the language.... The whole _POINT_ of D is to refactor C++/C99 while removing some very serious problems. It does a very good job of this. I don't know what you're talking about "but still suffers in many ways from their flaws"

    4. Re:More old junk repackaged to look new by canuck57 · · Score: 1

      Hey hey, calm down. Are you sitting now? Ok, read:

      Programming languages are to intended to be used by humans.

      I think this was the point. An irrational, illogical and flippant behavior carbon unit interfaces with a logical, predicable and consistent silicon interface is going to have issues. Unavoidable. Plan on it.

      The carbon unit can think, but the silicon cannot. So if the carbon unit is to be successful, they must understand the silicon, not the other way around. And that means pointers amongst other things.

      Programming languages are tools for carbon units to compile instructions for the silicon unit, a lack of being able to master what is going on at the silicon level is a limitation of the carbon unit, thus less effective. D isn't going to solve that at all.

    5. Re:More old junk repackaged to look new by DropArk · · Score: 1

      Programming languages are tools for carbon units to compile instructions for the silicon unit, a lack of being able to master what is going on at the silicon level is a limitation of the carbon unit, thus less effective. D isn't going to solve that at all. I have a slightly different take on that. I think that programming languages are tools for people to express to other people what they want a computer to do. A compiler is the tool to compile programs for the computer. And from my actual use of D in serious applications, it would seem that expressing algorithms to other people is more productive in the D programming language than in many other programming languages I've used.
  18. Re:Another 'Toy' Programming Language by nacturation · · Score: 4, Funny

    I'll stick to languages that have at least a professional following, in use by real software engineers (that is, engineers who can legally call themselves engineers), not the run of the mill code monkeys. I'm dying to know... do you mean Fortran or Lisp?
    --
    Want to improve your Karma? Instead of "Post Anonymously", try the "Post Humously" option.
  19. Do we really need another D infomercial? by Anonymous+Brave+Guy · · Score: 3, Insightful

    I'm sure D is a lovely language, but it just seems like another incremental change over C++, like Java and C# before it, and like both of those languages what it's lost and the opportunities it misses are as telling as the little tweaks it makes to improve things.

    No-one has yet been successful, IMHO, in developing a really good industrial programming language. Those that make it tend to be pragmatic, practical tools like C and Perl and FORTRAN and COBOL. To be sure, each of these has many widely-acknowledged weaknesses, but the overall balance between those weaknesses and what you could get done using the language was right.

    I can increasingly see why some well-known programming language designers shy away from feature comparison ticklists. I think it's because as soon as you go down this route, you bias the comparison so much that it's meaningless. For example, consider the first checklist cited in the Slashdot write-up. (I note in passing that this is a wiki, and may change before you read this.) Here are some of the "yes or no" (almost) categories:

    Templates or executable macros No difference in expressive power is acknowledged between LISP macros and C++ templates. Thread synchronization primitives With no reference to how expressive they are, and how powerful the idioms supported by them? This one is really telling, IMHO, because I don't believe the future lies in classical thread sync and locking primitives. The whole approach is just too prone to deadlocks and race conditions to withstand the heavily parallel future that multicore chips are starting to bring into the mainstream. When you have ideas like pure function programming languages, operating in a world without side-effects where explicit locking isn't necessary, or interesting ideas for inter-thread communication such as those in Erlang, another variation on built-in pthreads just isn't worth much. Enumeration So again, we acknowledge no difference between simple and low-level enumerations such as those in C, and concepts such as disjunctive types and pattern-matching that are very powerful, remarkably elegant, and mainstream in certain families of programming language. Again, this is just papering over a gap, where other languages operate on an entirely different level. Long double floating point (80bit) This is just desperation. Pretty much no-one uses 80-bit floating point arithmetic IME (and yes, I do work in the field). The portability hazards and lack of true support from almost every mainstream architecture make them almost irrelevant, except perhaps for a few very small niches. Lexical Closures Another telling omission: the power of all those neat functional programming features is dramatically reduced when you can't construct functions on-the-fly.

    On top of all of this, the feature lists invariably gloss over some less concrete things that are nevertheless very important to systems programming languages. How portable is D? How many production-quality implementations are available? Is the language standardised or under the control of a single, commercial body? How much backing is there behind the language in the commercial development space; do others write libraries specifically for this language, or is it reduced to using C-style interfaces at the lowest levels anyway, and what impact does this have on the usefulness of features like DBC, exceptions, and so on? Does the language have an active hobbyist/volunteer community supporting it?

    I could go on, but I don't want this post to disappear into the oblivion any more than it already will. Although I'm deliberately focussing on criticising in this post, as I often do with D, I keep an open mind and will happily engage in debate with others, or even be proved wrong by people who have found D to have compelling advantages. So go ahead, D advocates, start your counter-arguments here...

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    1. Re:Do we really need another D infomercial? by Anonymous Coward · · Score: 0

      some of my reasons for considering d are:
      -d is the first powerful language i could learn.
      -after i learned d i could learn c usage as well, but not before.
      -i've done a text processing program in d in a matter of minutes (well, probably 1h+, whatever) compared to 2-3 nights without sleep (and the corresponding days) in c. it is true that the latter was a 3d OBJ importer, but only i know how hard and messy it was.
      -i don't have to fight against pointers anymore;
      -i don't like c++, nor java (though i love curly brackets :P).
      i think you might give d a try, also check these differences, if you didn't already:
      http://digitalmars.com/d/cpptod.html
      http://digitalmars.com/d/ctod.html
      the readability and logic gives speed to developing.
      thanx

    2. Re:Do we really need another D infomercial? by stevenj · · Score: 2, Insightful
      Long double floating point (80bit) — This is just desperation. Pretty much no-one uses 80-bit floating point arithmetic IME (and yes, I do work in the field). The portability hazards and lack of true support from almost every mainstream architecture make them almost irrelevant, except perhaps for a few very small niches.

      Um, considering that the vast majority of the world's floating-point hardware is x86 and supports extended precision, saying that it lacks "true support from almost every mainstream architecture" is comical.

      (I agree that relatively few numerical applications need extended precision on a regular basis, but it is awfully useful on occasion. A very simple use is to assess the impact of roundoff error on a double-precision program: by far the easiest way is to increase the precision and see how much the answer changes, but this requires a floating-point type with greater than double precision. Yes, you could drop in an arbitrary-precision type, but this may be too slow in a large computation.)

      In any case, D's claim to this feature is a bit odd, since every x86 C/C++ compiler worth its salt already compiles long double to extended precision.

      --
      If a thing is not diminished by being shared, it is not rightly owned if it is only owned & not shared. S. Augustine
    3. Re:Do we really need another D infomercial? by Anonymous+Brave+Guy · · Score: 2, Interesting

      Ironically, I consider most of the C++ to D examples there to be flaws in D.

      Supplying predefined comparison operators is all very well, but what if a class doesn't support the concept of equality? Alternatively, suppose it supports only equality and not ordering, or vice versa? How do I do that in a natural way, with a single comparison function to define?

      The whole concept of relying on scoped variables completely misses a major advantage of RAII, which is that in the common usage, you can't forget anything (a delete, finally or in this case scope) and inadvertently skip the destructor. Requiring some special keywords to get this behaviour is just horrible.

      The construction/initialisation semantics just seem a mess. You've either introduced some hideous inefficiency and semantic problems (everything is default-initialised and then reassigned afterwards in the constructor if necessary) or you've introduced a horrible loophole (constructors can start messing around with uninitialised data, for example by calling another member function, before the class invariants are properly set up). The latter is even worse than the analogous loophole in C++.

      This sort of thing is exactly my big beef with D, and the reason I doubt I will ever seriously consider it for a non-trivial project in its current form. It's going for style over substance, PR hype over effectiveness. It does away with a few controversial things in C++, but some of its underlying models are simply broken, and as I illustrated elsewhere, its improvements in other areas are far from state-of-the-art.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    4. Re:Do we really need another D infomercial? by Anonymous+Brave+Guy · · Score: 2, Interesting

      Um, considering that the vast majority of the world's floating-point hardware is x86 and supports extended precision, saying that it lacks "true support from almost every mainstream architecture" is comical.

      Not really. Take a look at the performance, addressing modes, and so on. The support for 80-bit on Intel boxes is not the same as the support for 64-bit, at least in practical terms.

      Also, while the vast majority of the world's FP hardware may indeed run on x86 (I don't know), I would suggest that at least a very significant minority of the software that actually requires high-precision floating point work still runs on workstations which may well be based on other architectures.

      No-one wishes this were not so more than me, I promise you: I write high-performance, high-precision mathematical libraries for a living, and minor differences in behaviour across platforms or where precision has been lost are the bane of my working life.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    5. Re:Do we really need another D infomercial? by javilon · · Score: 1

      When you have ideas like pure function programming languages, operating in a world without side-effects where explicit locking isn't necessary, or interesting ideas for inter-thread communication such as those in Erlang, another variation on built-in pthreads just isn't worth much.

      You got me really interested here. Can you elaborate on this?

      --


      When his defense asked, "Which computer has Jon Johansen trespassed upon?" the answer was: "His own."
    6. Re:Do we really need another D infomercial? by Anonymous+Brave+Guy · · Score: 1

      I'm not an expert on these, but if you clarify which bit you're interested in I'll attempt to provide references. (If you've never encountered the functional programming world at all before, a head explosion awaits you, and you're about to question everything you ever thought you knew about programming. :-))

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    7. Re:Do we really need another D infomercial? by WalterBright · · Score: 1
      Long double floating point (80bit) This is just desperation. Pretty much no-one uses 80-bit floating point arithmetic IME (and yes, I do work in the field). The portability hazards and lack of true support from almost every mainstream architecture make them almost irrelevant, except perhaps for a few very small niches.

      With floating point, more precision is better. It's not just adding a few decimal points; algorithms like numerical integration are easily completely sabotaged by insufficient precision (creeping underflow, gradual accumulation of roundoff errors, etc.) The 80 bit floating point hardware has been on x86 machines for 25 years now. I can't understand how you can characterize that as a lack of true support from almost every mainstream architecture. The x86 pretty much is the mainstream architecture, from the 8087 through the AMD64. As for portability, if I'm using numerical analysis tools, I freakin' bought hardware that does 80 bits of precision. Why should I want my results dumbed down to the worst FPU built in the last 30 years? Language floating point support should be specified to be the BEST available on the hardware you're running on, not the WORST on someone else's machine. After all, if you buy a Ferrari you expect to get Ferrari performance, not have it throttled back to that of a 1970's AMC Gremlin.

    8. Re:Do we really need another D infomercial? by WalterBright · · Score: 2, Interesting
      In any case, D's claim to this feature is a bit odd, since every x86 C/C++ compiler worth its salt already compiles long double to extended precision.

      VC++ doesn't. Java doesn't. C# doesn't. Python doesn't. Ruby doesn't. 80 bit floating point is highly useful, and it's about time it was required for languages on FPUs that support it.

    9. Re:Do we really need another D infomercial? by Anonymous+Brave+Guy · · Score: 1

      I'm afraid the fact that you don't do this stuff for a living is painfully apparent here, Walter, though it does explain your belief in the value of the feature in D. Consider the following questions, if you will:

      1. On IA-32 machines, what instructions and register support are available for 32-bit floating point computations? 64-bit? 80-bit? Don't forget to include all the extended instruction sets and registers in the more recent processor series.
      2. What issues of non-convergence in numerical integration go away at 80-bit but get in the way at 64-bit?
      3. How many mainstream processor lines currently available do and don't support 80-bit calculation to acceptable performance?
      4. Which do you think customers typically consider more important, an extra couple of binary places of accuracy (when you're already correct to several orders of magnitude more than their working resolution anyway) or results that are as close to identical as possible across all hardware platforms?

      When you have established the correct answers to the above, perhaps you will understand why 80-bit has little value to most of us in today's environment.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    10. Re:Do we really need another D infomercial? by WalterBright · · Score: 1
      Supplying predefined comparison operators is all very well, but what if a class doesn't support the concept of equality? Alternatively, suppose it supports only equality and not ordering, or vice versa? How do I do that in a natural way, with a single comparison function to define?

      There are two comparison operators to overload, opEquals and opCmp. That's how you do it.

      The whole concept of relying on scoped variables completely misses a major advantage of RAII, which is that in the common usage, you can't forget anything (a delete, finally or in this case scope) and inadvertently skip the destructor. Requiring some special keywords to get this behaviour is just horrible.

      You can declare a class as being a scope class: scope class Foo { }, and it will automatically and always be RAII.

      The construction/initialisation semantics just seem a mess. You've either introduced some hideous inefficiency and semantic problems (everything is default-initialised and then reassigned afterwards in the constructor if necessary) or you've introduced a horrible loophole (constructors can start messing around with uninitialised data, for example by calling another member function, before the class invariants are properly set up). The latter is even worse than the analogous loophole in C++.

      This is more of a theoretical problem than an actual one. In practice, it just doesn't cause a problem. It also isn't possible to call a member function without the vptr being set up, so the alleged horrible loophole doesn't exist.

    11. Re:Do we really need another D infomercial? by Anonymous+Brave+Guy · · Score: 1

      OK, I'm quite willing to be proved wrong here (not least because that would mean that D is a better language IMHO) but I'm going by the way I read the pages of your own web site.

      There are two comparison operators to overload, opEquals and opCmp. That's how you do it.

      I could understand defining the < and == operators and then inferring the rest, but your opCmp appears to be a <=> concept, indicating less than, equal to or greater than. In that case, if a type supports only strict inequalities but not the concept of equality, how can you implement it as a combination of those operators? If neither a < b nor b < a nor a == b, then how does one represent this?

      I'm also curious about how you suppress the implicit equality test for structures, if the contents are not logically equality-comparable according to the program design. Is this any neater than the nasty C++ idioms for suppressing compiler-supplied constructors and assignment operators?

      You can declare a class as being a scope class ... and it will automatically and always be RAII.

      Your own web site's RAII example seems to use the scope keyword twice, once for the class definition and once where it is instantiated. If you can't accidentally write something like the following:

      File f = new File();

      in D, then I suggest that it would be in your interests to rewrite your explanatory text a little to make this clear.

      It also isn't possible to call a member function without the vptr being set up, so the alleged horrible loophole doesn't exist.

      So can one constructor call another before initialising all the data members of a class to satisfy the class's invariant conditions, or can't it? If it can, how does any constructor know what's been initialised already and what hasn't when it's called? If it can't, what's the advantage of chaining constructors together like this?

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    12. Re:Do we really need another D infomercial? by WalterBright · · Score: 1
      If there is no ordering relationship between two instances of an object, you can override opEquals and opCmp to throw an exception.



      All the data members (including the vptr) to a class are initialized before the constructor is called. The purpose of chaining constructors (a feature proposed for C++) is to be able to avoid code cut & paste between constructors. The class invariant does not need to be satisfied until after the constructor is done, not during its execution.

    13. Re:Do we really need another D infomercial? by radtea · · Score: 1

      Another telling omission: the power of all those neat functional programming features is dramatically reduced when you can't construct functions on-the-fly.

      All these on-the-fly kind of features, for example anonymous inner classes in Java, are enemies of good programming practice. They are suitable for scripting languages, but they encourage developers to define essential functionality in the middle of blocks of more-or-less unrelated code, making that functionality impossible to reuse and potentially difficult to debug.

      Features like this have a certain theoretical nicety, but they make the overall design, development and documentation process very hard to implement in a well-engineered way. How do you discuss the design of a block of code that doesn't even have a name?

      I know that these features can be used in safe and intelligent ways, but I also know from experience that managing a project in a language that permits them can allow even diligent, professional developers to hide a multitude of sins in places that are hard to see, difficult to debug and nearly impossible to maintain.

      --
      Blasphemy is a human right. Blasphemophobia kills.
    14. Re:Do we really need another D infomercial? by Anonymous+Brave+Guy · · Score: 1

      If there is no ordering relationship between two instances of an object, you can override opEquals and opCmp to throw an exception.

      So the only way to represent the concept of a class with an ordering but no equality is to have a run-time failure every time someone tries to compare them for equality?

      All the data members (including the vptr) to a class are initialized before the constructor is called.

      So any members whose values are set in the constructor will always be modified twice during construction?

      I hope I'm misunderstanding you, because both of those are serious weaknesses in a systems programming language, and serious steps backwards from C++.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    15. Re:Do we really need another D infomercial? by Anonymous+Brave+Guy · · Score: 1

      All these on-the-fly kind of features, for example anonymous inner classes in Java, are enemies of good programming practice.

      I'm sure everyone in the functional programming community would agree with you. They do, after all, have terrible problems with program conciseness and high bug counts relative to languages like C++ and D. ;-)

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    16. Re:Do we really need another D infomercial? by WalterBright · · Score: 1
      Contrary to your fact, I used to do numerical analysis work for Boeing when doing actual design work. I wrote my own programs (in FORTRAN) to do it. You're not the first, and I'm sure you won't be the last, to assume I don't know what I'm doing with floating point. You might be interested to know that a number of engineers and mechanics at Boeing tried to prove my results wrong (as well they should, checks and balances are critical to building safe airliners). Either their calculations wound up backing mine, or the test results proved my numbers right.

      1. All x86 processors support the 80 bit FPU instructions (either integrated in, or via the add-on x87 FPU). Want me to list them? ST0..7, FADD, FSUB, FCOMPP, etc.

      2. With floats, you can invert up to a 7x7 matrix before the results go beserk. With doubles, this goes up to maybe 16. With 80 bit long doubles, 20. There are algorithms to invert larger matrices and account for the roundoff error, but they are complex and unnecessary if you have sufficient precision to begin with. Numerical integration is another problem area that is mitigated by more precision.

      3. Isn't x86 mainstream enough for you? It is for me and probably 90% of the computer users out there.

      4. Your question shows a serious misunderstanding how floating point roundoff problems affect results. Perhaps I can best illustrate it with a real life example. I was once given the job of double checking another engineer's calculations on a project. The calculation involved about 30 steps, the result of the previous being fed into the next. My results differed by a factor of 2. That's right, 100% off, not .01% off. So off I went to figure out why. Turns out, the engineer had rounded off each step to two decimal places, before feeding the numbers into the calculator for the next step. After all, as he told me, 2 decimal places was "good engineering precision", and further precision was not necessary. I, on the other hand, used the full 10 digits on my calculator, rounding to 2 decimal places as the very last step. The other engineer simply did not believe that premature rounding was the source of his way-wrong calculations, no matter how I tried to explain it to him. So, I tried a different tact. Working the algrebra of the calculation, I discovered it could be reduced from 30 steps to 3 steps. The 3 steps produced the same answer I had before.

      In other works, extra precision is vital, even when more than just "working resolution." Premature roundoff is evil (and if you take a quality physics or engineering course, they'll hammer that into your brain - where I went to college, if you prematurely rounded off anything, you automatically got a big fat 0 for that problem).

      Now, to answer your question, as a mechanical engineer designing systems that many lives and millions of dollars were flying on, I didn't give a f*** about portability. I wanted the RIGHT answer. The right answer is much easier to get when there's more precision. I want to use the FULL precision the FPU I'm using can deliver. I'm not using some other crappy FPU, why should my results get compromised by its mere existence? Now, if your customers consider portable wrong answers to be more desirable than correct answers on the machines the customer has, then I sure hope they aren't designing airplane parts.

    17. Re:Do we really need another D infomercial? by metamatic · · Score: 3, Interesting
      So the only way to represent the concept of a class with an ordering but no equality is to have a run-time failure every time someone tries to compare them for equality?

      What do you think a programming language should do when I try to compare two things that can't be compared for equality?

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    18. Re:Do we really need another D infomercial? by stevenj · · Score: 1
      Not really. Take a look at the performance, addressing modes, and so on. The support for 80-bit on Intel boxes is not the same as the support for 64-bit, at least in practical terms.

      I can compile a single x86 code that uses extended precision and works on all x86 CPUs in recent memory. Of course, the speed varies, but you are stretching to argue that the extended precision isn't widely supported.

      --
      If a thing is not diminished by being shared, it is not rightly owned if it is only owned & not shared. S. Augustine
    19. Re:Do we really need another D infomercial? by DropArk · · Score: 1

      So the only way to represent the concept of a class with an ordering but no equality is to have a run-time failure every time someone tries to compare them for equality? That is correct. There is no mechanism yet to inform the compiler that a specific class must not implement a specific method (in this case an operator override). This would be a useful addition to help coders more accurately express correct behaviour, and whose infractions would be detected at the eariest time, i.e. compile time. But does the lack of this functionality condemn the D language?

      So any members whose values are set in the constructor will always be modified twice during construction? This is the 'default' behaviour. The coder can specify that they do not want automatic data initialization for any class members. Often the default initialization value is the very one that the constructor would set anyway. However, if you are wondering how a constructor down the 'chain' can detect if a data member has already been initialized or not, then this issue is not restricted to D. How would such a sub-constructor know that, regardless of the language used, if there wasn't a concept of an 'uninitialized' value which is automatically set at run-time? With D, by allowing automatic data initialization, it is in fact possible for sub-constructors to detect 'uninitialized' values.
    20. Re:Do we really need another D infomercial? by TheLink · · Score: 1

      Sorry, it seems most people prefer "popular wrong answers" to correct answers.

      That's why you have: C, C++, and George W Bush. ;).

      --
    21. Re:Do we really need another D infomercial? by Carewolf · · Score: 1

      It's implemented through simulation in newer x64 cpu's so you might as well write it using 64bit yourself and get the extra compiler optimizations and portability.

    22. Re:Do we really need another D infomercial? by Halo1 · · Score: 1

      1. All x86 processors support the 80 bit FPU instructions (either integrated in, or via the add-on x87 FPU)

      Currently they still do, yes, but I wouldn't be surprised if it was going to phased out in the not too distant future. E.g. Win64 simply doesn't support usage of the 80x87 anymore, and requires that you use the SSE unit for all floating point math.

      --
      Donate free food here
    23. Re:Do we really need another D infomercial? by WalterBright · · Score: 1

      Early versions of Win64 did not support the 80 bit x87, but that bug has been fixed.

    24. Re:Do we really need another D infomercial? by rockmuelle · · Score: 1
      Long double floating point (80bit)
      This is just desperation. Pretty much no-one uses 80-bit floating point arithmetic IME (and yes, I do work in the field). The portability hazards and lack of true support from almost every mainstream architecture make them almost irrelevant, except perhaps for a few very small niches."


      This isn't quite true. While lanugages and programmers rarely use extended precision floating point numbers directly, the registers on IA-32-based chips are 80-bit registers. All instructions operate on 80-bit values. Values that stay in registers over the course of a computation benefit from the added precision.

      For most applications, this isn't terribly important. But, for the accuracy of numeric applications, it's very useful. Numeric applications that use the FPU are inherently more accuarate on IA-32 systems than other architectures. Unfortunately, most languages don't let the programmer control when values stay in registers (the register keyword is ignored by most compilers), so any benefit from this for most software is purely accidental, or the result of hand-coded assembly.

      I'm glad to see a language taking extended precision seriously. As libraries that rely on numeric code become more common (think data mining, feature tracking in images, automated car-parking algorihtms, etc), the effects of accurate computations will be visible to more end users. But, it may be too little, too late... Intel is moving away from the FPU and towards SSE, with a max of 64-bits for floating point numbers. It may be years before we get another commodity processor line that gives us a little extra accuracy for free.

      For some more reading on the topic, here's a good academic rant with lots of examples and experiments that illustrate the differences between 64-bit and 80-bit floating point numbers.

      -Chris

    25. Re:Do we really need another D infomercial? by Agronomist+Cowherd · · Score: 2

      It should give a compile time error, of course. Run-time exceptions that pop-up in little used code paths are evil.

      --
      -DwS
    26. Re:Do we really need another D infomercial? by raxx7 · · Score: 1

      While x86's x87 unit supports 80 bit floats, the use of x87 is depreceated in favor of the more sane SSE2 wich does not support 80 bit floats.

      And no, x86 isn't mainstream enough. There's a world of RISC embedded CPUs out there that do not support 80 bit format.

      Your example of the engineer rounding off results to two decimal places is a good example of how round off can adversely afect results but one must remember that roundoff is not necessarly the limiting factor in the error of your results.
      With 64 bit floats, the most common source of error I see people stumbling into is not the rounding imposed by the floating point format but either measurment error or aproximation error.
      The measurment error comes from the fact that usually either the input will be taken from the real world or the output will be compared to the real world or both. And measuring the real world involves an error, which will then propagate throughout the calculus.
      The aproximation error comes from the fact that often our calculations involve expressions that can't be analytically resolved or are too expensive and have to be replaced by aproximations, which have some error.
      This is not to say that more precision isn't ocasionally usefull. Obviously, someone also thought so when x87 was created. Some Cray supercomputers had 96 bit floats too.
      But mostly, it hasn't seem much demand. Even most supercomputers with custom CPUs have only 64 bit floating point.

      It's also possible that if demand for a floating point format with higher precision comes, it will be a 128 bit format, not the actual 80 bit one.

    27. Re:Do we really need another D infomercial? by stevenj · · Score: 1

      VC++ is not worth its salt, especially for numerical work. (Not too surprising, as Microsoft is the same entity that decreed Windows wouldn't set the x86 FPU in extended -precision mode.) And the other languages you cited are not C/C++. It's no problem to find a C/C++ compiler for x86 that compiles long double to extended precision on x86.

      --
      If a thing is not diminished by being shared, it is not rightly owned if it is only owned & not shared. S. Augustine
    28. Re:Do we really need another D infomercial? by WalterBright · · Score: 1

      80 bit reals are needed for accurate numerical analysis work. They are not needed for games, which SSE2 seems to be targetted at. After all, if a game computes the physics wrong, who cares? It's about time, though, that the needs of numerical analysts are properly supported by a modern language, and D aims to support them fully.

      I doubt numerical analysts are using embedded RISC processors. I bet most of them use desktop machines, and those are overwhelmingly x86 based and have hardware 80 bit FPUs on them. And once again, why should analysts who paid for and have high precision hardware on their desk be forced to use floating point dumbed down to the worst FPU on the market? It makes no sense. It's like arguing that a $500 stereo receiver should be deliberately fuzzed so its sound quality isn't better than a transistor radio's.

      Your argument also seems to imply that if the input data has error in it, that it doesn't matter if the intermediate calculations introduce more errors in them. Again, this is a serious fundamental mistake in doing numerical analysis. In the example I gave, the engineer made the same argument: the input measurements weren't remotely accurate to 10 digits, they were accurate to 3, so 10 digits for the intermediate results was unnecessary. How wrong that was - his answer was 100% off, all caused by introducing more (roundoff) error with every step of his calculation.

    29. Re:Do we really need another D infomercial? by WalterBright · · Score: 2, Insightful

      VC++ is one of the most widely used C++ compilers. The fact that it does not support 80 bit long doubles has apparently convinced a lot of people that such precision is unnecessary - and this wrong idea tends to propagate into other languages, since language designers are rarely familiar with numerical analysis.

      The C++ Standard allows this to happen with C++ compilers. It's about time, however, that modern languages have decent, proper support for numerical analysis, and that means requiring the support of the full precision of the underlying hardware. D aims to fully support numerical analysis needs.

      If other languages refuse to do so, well, that's another reason why there is a need for D.

    30. Re:Do we really need another D infomercial? by Anonymous Coward · · Score: 0

      Forgive the stupid question, but if you are really doing this kind of numerical analysis, why are you using 80 bit reals instead of an arbitrary precision kit like gmp?

      For that matter, why do this kind of work in a C-like language rather than something more numbers friendly?

    31. Re:Do we really need another D infomercial? by raxx7 · · Score: 1

      I'm going to start in the end.

      The round off error doesn't matter if the error introduced by round off is smaller than the error in the value.
      The rule of thumb I learned is that intermediate results should have one more digit than the significant digits. Your fellow engineer violated that rule, hence the catastrophic results.

      If I have two measurements, X and Y with an error of 0.1 and I calculate X+Y, it doesn't really matter that I use a representation with an error of 0.01 or 0.0001.
      Yes, the result of X+Y will differ but in both cases the true value will be somewhere in (X+Y)±0.2.

      The net result is that I haven't seen much demand for >64 bit floats, even though in Linux C's long double does translate to 80 bit on x86 and IPF.
      Even supercomuters made with custom made CPUs (which often require code to be tweaked anyway) have ignored >64 bit floats for over a decade now.

      As for SSE being targeted at games, the design of x87 has never been much liked because it's complex to deal with, both for the hardware implementations and for the software that uses it, mainly due to the stack based aproach.
      It's being overall disfavoured by SSE2 which provides a more common flat register file. Both Linux and Windows x86-64 bit ABI rely on SSE2 for 32 and 64 bit floats.
      Microsoft's documentation even says that, for 64 bit applications, x87/MMX register file isn't saved across context switches, although the observed behaviour is that it does indeed save the register file.
      It's very likely that in the near future x87 performance will become a second class issue for x86 designers. Actually, Pentium 4 already did so, since it didn't implement FXCH as a "free" instruction.

      It's your language but due to all of the above I think requiring 80 bit floats places an uneeded burden on non-x86/IPF implementations and on it's future.

    32. Re:Do we really need another D infomercial? by Anonymous+Brave+Guy · · Score: 1

      OK, let me put this simply first: all numerical analysis is inexact, and for many real world numerical analysis tasks, performance and/or portability are more important than being slightly less inexact.

      To address the four specific issues I raised previously:

      1. The recent Intel chips don't provide anything like the same level of support for 80-bit as for 64-bit floating point. Sure, the x87 stack registers are 80-bit and there are corresponding opcodes to manipulate them, but once you're into the extended instruction sets it's 64-bit (or other powers of 2) all the way. Incidentally, does the D compiler take full advantage of these wider instruction sets?
      2. You're missing the point with matrices, perhaps because you seem to be thinking in terms of small matrices while for many of us the problem cases can easily be 1,000x1,000 or more. Of course we use algorithms to minimise the errors introduced, but at this scale you are always going to have a significant degree of error. The problem cases tend to be near-singular systems, and it's often better to diagnose this and then adapt your data or process it in a different way to avoid running into the singularity, rather than hoping in vain that the numbers will come good with just an extra n bits of precision.
      3. No, x86 isn't portable enough. I write libraries that ship on just about every major desktop OS in use today, from MS Windows to Linux to Solaris to HP-UX to MacOS to... In fact, we'll support just about any platform our customers ask us to, if we can. You can infer from that that we have active customers wanting to use all of those platforms, which in turn tells you that people in our industry don't just use x86 boxes for numerical analysis. 90% of computer users don't matter to me, but our customers do.
      4. Your example is silly. Most serious numerical analysis work cannot hope to compute results to full precision, and therefore need algorithms that perform error analysis to determine the degree to which your results are reliable. Such analysis would immediately reveal the unreliability of the results in your anecdote, even if it weren't blindingly obvious to anyone who'd sat through the first half-hour of a numerical analysis lecture course. In any case, it's rather disingenuous to take dropping all but 2 sig figs vs. all but 10 (or all but 2 decimal places, though that is a bizarre measure of accuracy in this context) and pretend it's the same kind of problem as dropping all but 15 sig figs vs. all but 19, particularly when answers are typically not required to anything like these accuracies for most industrial applications.

      Now, to answer your question, as a mechanical engineer designing systems that many lives and millions of dollars were flying on, I didn't give a f*** about portability. I wanted the RIGHT answer. The right answer is much easier to get when there's more precision. I want to use the FULL precision the FPU I'm using can deliver. I'm not using some other crappy FPU, why should my results get compromised by its mere existence? Now, if your customers consider portable wrong answers to be more desirable than correct answers on the machines the customer has, then I sure hope they aren't designing airplane parts.

      That's a great example. Assuming your typical aircraft engine is ~10m across, the resolution our customers use would give a guaranteed accuracy of ~100nm. Tell me, did you design your parts to more precision than that?

      And actually, since I currently work in CAD, it's quite likely that the people ultimately using our maths do design critical things like aircraft parts. Fortunately, since our code places a great emphasis on portable results and on quantifying errors rather than hoping for the best, the parts they design on one system do tend to fit together with the parts they design on another, the whole lot tends to work as designed, and your chances of falling out of the sky aren't too bad. :-)

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    33. Re:Do we really need another D infomercial? by WalterBright · · Score: 1
      The round off error doesn't matter if the error introduced by round off is smaller than the error in the value. The rule of thumb I learned is that intermediate results should have one more digit than the significant digits.



      That rule of thumb is a pernicous source of error if you are doing repetitive calculations. Why add more error to your results if you don't have to?



      If I have two measurements, X and Y with an error of 0.1 and I calculate X+Y, it doesn't really matter that I use a representation with an error of 0.01 or 0.0001.
      Yes, the result of X+Y will differ but in both cases the true value will be somewhere in (X+Y)±0.2.



      Now try doing a 30 step calculation, rounding off after each step. Try it with and without rounding.



      The net result is that I haven't seen much demand for >64 bit floats, even though in Linux C's long double does translate to 80 bit on x86 and IPF.



      You haven't seen the demand because, as this thread illustrates, few understand the problems they get into with low precision. I've seen plenty of people blindly accept the wrong floating point answers they get because they imagine computer math is perfect. The engineer I worked with simply could not understand how roundoff affected his results. He's not atypical.



      As for SSE being targeted at games, the design of x87 has never been much liked because it's complex to deal with, both for the hardware implementations and for the software that uses it, mainly due to the stack based aproach.



      True, but that has nothing to do with its support for extended precision.



      It's being overall disfavoured by SSE2 which provides a more common flat register file. Both Linux and Windows x86-64 bit ABI rely on SSE2 for 32 and 64 bit floats.
      Microsoft's documentation even says that, for 64 bit applications, x87/MMX register file isn't saved across context switches, although the observed behaviour is that it does indeed save the register file.



      Microsoft hasn't updated their doc, then, because they indeed have deliberately fixed it.



      It's very likely that in the near future x87 performance will become a second class issue for x86 designers. Actually, Pentium 4 already did so, since it didn't implement FXCH as a "free" instruction.



      Performance is for gamers where wrong answers don't matter. For numerical analysts, getting the correct answer is far, far more important than getting a quick wrong answer.



      It's your language but due to all of the above I think requiring 80 bit floats places an uneeded burden on non-x86/IPF implementations and on it's future.



      It doesn't require 80 bit floating point on architectures that don't have it. It requires that the greatest precision supported by the architecture must be supported.

    34. Re:Do we really need another D infomercial? by Anonymous+Brave+Guy · · Score: 1

      This would be a useful addition to help coders more accurately express correct behaviour, and whose infractions would be detected at the eariest time, i.e. compile time. But does the lack of this functionality condemn the D language?

      It doesn't condemn D, but if you're going to put your product forward as a superior replacement to an established player, it's a good idea not to be qualitatively worse than that player...

      However, if you are wondering how a constructor down the 'chain' can detect if a data member has already been initialized or not, then this issue is not restricted to D. How would such a sub-constructor know that, regardless of the language used, if there wasn't a concept of an 'uninitialized' value which is automatically set at run-time?

      This isn't a problem if your language doesn't support sub-constructors in the first place. Again, it's not really fair to say that other languages would have the same problem in the same situation, when the situation is one of D's making.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    35. Re:Do we really need another D infomercial? by WalterBright · · Score: 1
      1. The recent Intel 64 bit floating point support is all about speed. It doesn't do a thing for greater accuracy. Even in 64 bit CPU mode, the 80 bit FPU instructions are still there and still supported. D uses the x87 FPU even for 64 bit types because the intermediate results are done to 80 bit precision.

      2. I'm well aware that greater precision isn't going to help with a 1000*1000 element matrix inversion, that what is needed is a better algorithm. Those better algorithms, however, are non-obvious, and great care and expertise has gone in to developing them. That doesn't help one whit, however, if you're doing a complex calculation that isn't a matrix inversion using a library built by an expert. A lot of calculations are custom algorithms written by people who simply don't have the time or expertise to deal with roundoff error. For those, extended precision helps a great deal in mitigating roundoff error problems.

      3. Windows, Linux, and MacOS are on x86 boxes that have the 80 bit FPU available. Once again, if your customer has paid for an FPU with 80 bits, why should his (not your) results be dumbed down to the worst FPU you support?

      4. Of course, I never blindly assumed my results weren't corrupted by roundoff error. Sanity checks, reverse calculations, and error analysis were done to check the results. If roundoff error was corrupting my results, that meant more work I had to do to find a way to fix it. More precision means fewer such problems, and more productivity.

      Assuming your typical aircraft engine is ~10m across, the resolution our customers use would give a guaranteed accuracy of ~100nm. Tell me, did you design your parts to more precision than that?



      Um, there's a lot more to aircraft part design than CAD drawings. Your comment shows you really don't know what's involved. But yeah, I've heard such comments from other engineers, too. Read on for what happened to them.



      And actually, since I currently work in CAD, it's quite likely that the people ultimately using our maths do design critical things like aircraft parts. Fortunately, since our code places a great emphasis on portable results and on quantifying errors rather than hoping for the best, the parts they design on one system do tend to fit together with the parts they design on another, the whole lot tends to work as designed, and your chances of falling out of the sky aren't too bad. :-)



      Portable wrong answers don't help one's design work. Not a bit. (They can also lead you into a false sense of security - if you're getting different answers on different machines, you know you've got a problem. The same wrong answer would be overlooked.) I've worked with engineers who did not place value on getting the most exact answers practical. I can tell you where they spent their nights and weekends - out on the shop floor, trying to figure out why their parts did not fit together, did not work, broke on the test stand, etc. Remember that 30 step calculation? It was for the stabilizer trim shutoff system. The shop mechanics, veterans of decades of new airplane design, told me it was the first one that fit together and worked dead nuts on right out of the box. All of the stuff I did calcs on fit together and worked as designed, first time. If you haven't guessed, I'm damned proud of it, too.



    36. Re:Do we really need another D infomercial? by WalterBright · · Score: 1
      Fortunately, since our code places a great emphasis on portable results and on quantifying errors rather than hoping for the best,

      I want to comment on that a bit further. If I ran your code on one machine with high precision, then on another machine with low precision, and the results were comparable, then that's a confidence builder in your software. It means the results are likely not affected by roundoff error. But if your code uses the same precision on all platforms, then getting the same results on different platforms would say nothing about the precision of the results.

    37. Re:Do we really need another D infomercial? by Anonymous+Brave+Guy · · Score: 1

      1. The recent Intel 64 bit floating point support is all about speed.

      In the past year, I've lost count of how many performance bugs we've had from our customers. Many of them have unrealistic expectations, but their focus on speed is clear. Can you guess how many of them said our algorithms weren't accurate enough? Hint: 0.

      2. I'm well aware that greater precision isn't going to help with a 1000*1000 element matrix inversion, that what is needed is a better algorithm. Those better algorithms, however, are non-obvious, and great care and expertise has gone in to developing them. That doesn't help one whit, however, if you're doing a complex calculation that isn't a matrix inversion using a library built by an expert.

      So your argument in favour of 80-bit is that incompetents who need high-accuracy calculations benefit from it? Well, that may be true, though it's clearly a false sense of security, and it's hardly a compelling argument for the importance of 80-bit calculation to the field of numerical analysis.

      Please remember, I'm not arguing that, other things being equal, 80-bit isn't better than 64-bit. Of course more precision is helpful for some fields. I'm simply arguing that the extra 16 bits have a relatively low priority for many people working in the field, for whom 64-bit is already good enough.

      3. Windows, Linux, and MacOS are on x86 boxes that have the 80 bit FPU available. Once again, if your customer has paid for an FPU with 80 bits, why should his (not your) results be dumbed down to the worst FPU you support?

      Linux runs on lots of things, as do some versions of Windows.

      Um, there's a lot more to aircraft part design than CAD drawings. Your comment shows you really don't know what's involved.

      I gave a single illustration to show that even 8 decimal sig figs can be accurate enough for real applications, and you infer from this that I know nothing about anything but CAD? Interesting conclusion jump. Wrong, but interesting.

      Portable wrong answers don't help one's design work.

      And this is where your whole argument falls apart every time. Our answers are not wrong. They may be less accurate, but they are still correct to the accuracy specified by our customers, and typically rigorously proven to be so. No-one would use our stuff without such guarantees. More accuracy than that, at the expense of speed or portability, simply is not something our customers tell us they want.

      Again, I have never disputed that, in some niches, some extra precision really will make a useful difference. Of course different projects have different priorities. But IME, working in a variety of high-precision industrial environments during my career from the aforementioned CAD stuff to metrology analysis software, there is usually a point beyond which further accuracy isn't worth a lot, and other features (such as being able to perform sufficiently accurate computations in real-time or close to it) are more important.

      In this context, while using 80-bit floating point may be a mark in D's favour, it is clearly vastly less significant than many of the other categories (and indeed notable omissions) in the checklists linked from the original Slashdot story.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    38. Re:Do we really need another D infomercial? by raxx7 · · Score: 1
      That rule of thumb is a pernicous source of error if you are doing repetitive calculations. Why add more error to your results if you don't have to?


      Now try doing a 30 step calculation, rounding off after each step. Try it with and without rounding.


      Yes, I know the the significant digits rule are a source of problem since they don't always ask for enough digits. But violating them is sure way for ugly results.

      Let's say, that Y = X1 + X2 + ... + X30, with Xi±0.10.

      Even without any rounding in the calculation, the result will have an error of ±0.5477225575...

      But I'd represent that number as RRRR.RR±0.55, it's pointless to have any more.

      I don't remember how to calculate the rounding errors and I'm not going to look it up now but with enough guard digits, the round error won't show up in that representation. Which is my point all along: there is such thing as enough guard digits.



      You haven't seen the demand because, as this thread illustrates, few understand the problems they get into with low precision.
      That's a fallacy: you're stating that we don't know we're talking about because we have a diferent opinion.

      Cray, NEC and IBM's customers don't understand the issue either because neither of their latest custom CPUs support such thing (even though Cray did support so in the distant past).

      Nor HP and CERN's group who wrote a high performance vector library for IPF with 0.502 ulp acuracy in most or all functions, but ignored 80 bit floats.


      Performance is for gamers where wrong answers don't matter. For numerical analysts, getting the correct answer is far, far more important than getting a quick wrong answer.

      That's complete bullshit.

      Maybe you should try to tell that to my friend who spent the entire chrismas vacation squeezing out every last minute of CPU time he was granted on a cluster.

      More often than not, a good enough answer in reasonable time is better than a acurate answer in a unreasonable time. That's why you see people a never ending increase in the complexity and acuracy of simulations. It's not that people didn't want them before, they just couldn't aford them.





      It doesn't require 80 bit floating point on architectures that don't have it. It requires that the greatest precision supported by the architecture must be supported.

      My bad then, I can live with this. We already have so in C/C++, except in Windows.

    39. Re:Do we really need another D infomercial? by WalterBright · · Score: 1
      In the past year, I've lost count of how many performance bugs we've had from our customers. Many of them have unrealistic expectations, but their focus on speed is clear. Can you guess how many of them said our algorithms weren't accurate enough? Hint: 0.



      I'm not surprised. Few engineers understand the problems with accumulated roundoff error. I'm not the only one who's noticed this, Chuck Allison runs packed seminars helping engineers understand the problem. Part of your job, as a tools vendor, is not just provide what they say they want, but to provide them with the best results possible, because YOU are supposed to understand the problem better than they do. You'll serve your customers' interests better if you help educate them about the issues and how to deal with them.



      So your argument in favour of 80-bit is that incompetents who need high-accuracy calculations benefit from it?



      Not everyone who is a competent physicist, scientist, or engineer, is also a top expert in floating point. Not everyone has the time to develop complex algorithms to deal with low precision arithmetic when high precision will get them the needed results with much less effort.


    40. Re:Do we really need another D infomercial? by Anonymous+Brave+Guy · · Score: 1

      I'm not surprised. Few engineers understand the problems with accumulated roundoff error.

      The arrogance of that statement defies belief!

      Do you really believe that you understand the mathematical requirements of computer-aided design software better than the entire CAD industry?

      I'm also really curious about how you, as a man who's spent the last several years writing compilers, knows more about state-of-the-art numerical analysis techniques than an office full of highly-qualified and experienced people who work in this field every day.

      Not everyone who is a competent physicist, scientist, or engineer, is also a top expert in floating point.

      Indeed, and the smart ones hire people like me to explain the necessary basics to them for a while, or to consult on the technical details of their software as necessary.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    41. Re:Do we really need another D infomercial? by WalterBright · · Score: 1
      Let's say, that Y = X1 + X2 + ... + X30, with Xi±0.10. Even without any rounding in the calculation, the result will have an error of ±0.5477225575... But I'd represent that number as RRRR.RR±0.55, it's pointless to have any more.

      I once had a similar conversation with my lead engineer. He asked me why I specified the length of one part as NN with a tolerance of +.0134 and -.0178, and didn't just round them to two places, +.01 and -.01. I answered that the part cost $10,000 to make, and parts often do come in out of spec. When that happens, they try to save those expensive parts, and bounce them back to engineering to see if they are ok anyway. By giving the widest possible tolerance range, instead of cutting it back for mere notational convenience, more parts would be acceptable, thus saving rework and reengineering costs. Avoiding roundoff increased the tolerance range from .02 to .0312, quite a jump. He accepted that, and signed off on it.

      In other words, I always did the calcs to get the widest possible tolerance range, and was able to thereby cut the manufacturing cost substantially.

    42. Re:Do we really need another D infomercial? by IpalindromeI · · Score: 1

      How about not compile? If equality isn't defined, the compiler shouldn't accept it.

      --

      --
      Promoting critical thinking since 1994.
    43. Re:Do we really need another D infomercial? by raxx7 · · Score: 1

      It's not the same thing.

      A part tolerance is usually a result, not a result's error.
      You made some calculations, problably arrived at an upper tolerance value like 0.0134AAA±0.00000BB, decided the result was good up to 0.0134 and thus specified it as 0.0134. Similar for lower tolerance.
      I'd have done the same thing.

      I had 30 hypothetical values of Xi±0.01, added them all together and arrived at a result of RRRRRRR.RR±0.5477225575...
      Since Xi were specified to the second decimal place, I decided there isn't any significance of R beyond the second decimal place, so I wrote it as RRRRRRR.RR±0.55. Even RRRRRRR.R±0.6 migh be aceptable.

    44. Re:Do we really need another D infomercial? by metamatic · · Score: 1

      Well, in general that assumes the language is totally statically typed. If I wanted that kind of tradeoff for type safety, I'd be writing Java.

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    45. Re:Do we really need another D infomercial? by Anonymous Coward · · Score: 0

      You still don't get it and I doubt this will change your mind. A good programmer has an open mind. I doubt all your CAD "friends" are so closed minded.

      Maybe your CAD applications don't need 80bit, but many scientific applications do. Actually there are even algorithms in graphics that can do with extra precision (at least in the compilation stage).

      16bit is a huge amount more precisions. Until you start having 64bit precision problems you can't see the whole picture. I'm sure this will not change your mind, your so admit about being right. I've had similar problems with other programmers who can't see past there own "brilliance", they are the hardest to work with.

      If you are truly interested learning (and the best programmers are still learning) something in 80bit, you may try a little googling.

    46. Re:Do we really need another D infomercial? by Anonymous Coward · · Score: 0

      Lol!

      > This isn't a problem if your language doesn't support sub-constructors in the first place.
      > Again, it's not really fair to say that other languages would have the same problem in the
      > same situation, when the situation is one of D's making.

      This is great! Just the type of constructive critism a language needs. If it has problems don't include it. Just like templates in C#, pointers in java, D does it with mutliple inheritance ect... I don't think there would be much left of C++ if this rule was applied when it was developed.

      But seriously, how would you fix the issue elegently it without taking out the sub-constuctors? Can you provide examples?

    47. Re:Do we really need another D infomercial? by streepje · · Score: 1

      So the only way to represent the concept of a class with an ordering but no equality is to have a run-time failure every time someone tries to compare them for equality?

      What do you think a programming language should do when I try to compare two things that can't be compared for equality?

      Read the parent. It's about a class which has an ordering but no equality. This is a useful and practical notion: a set of entities about which you can determine whether one is larger than another in some sense without necessarily having a notion of equality.

      But this is just one small example of what you get with a language that makes no attempt to define any semantics whatsoever.
    48. Re:Do we really need another D infomercial? by metamatic · · Score: 1

      Yes, I understand what "has an ordering but no equality" means. I wasn't questioning the usefulness of the notion, I was asking what you would expect the language to do when you try to compare two objects for equality and they don't have an equality defined, since apparently throwing an exception is unacceptable.

      Presumably you're one of those "static type system" people? So you'd want a compile time error?

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    49. Re:Do we really need another D infomercial? by Anonymous+Brave+Guy · · Score: 1

      So are you really Walter, Mr AC, or just pretending to be?

      In any case, you're right that programmers should have an open mind. You might start by opening yours to the possibility that I (and, I notice, several others posting in this discussion now) do actually have a clue about the real world requirements of numerical analysis, and that it is possible that a little extra precision really isn't that high a priority. Once again, remember that we're not saying it has no merit at all, nor that there aren't applications that don't benefit significantly from it, just that for most applications, it isn't that important in the grand scheme of things.

      16bit is a huge amount more precisions. Until you start having 64bit precision problems you can't see the whole picture.

      ROFLMAO. I have spent much of my working life dealing with those problems: devising ways around them, coping with awkward boundary cases, quantifying the loss of precision during algorithms, assessing whether that loss is within acceptable tolerances. And you know what? If I had an extra few bits to play with, I'd have exactly the same issues to deal with, for exactly the same reasons.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    50. Re:Do we really need another D infomercial? by Anonymous+Brave+Guy · · Score: 1

      Just the type of constructive critism a language needs. If it has problems don't include it.

      Considering how often exactly that position is taken by adovcates of languages like Java and now D, at the expense of alternatives like C++, your position is rather hypocritical.

      But seriously, how would you fix the issue elegently it without taking out the sub-constuctors? Can you provide examples?

      Well, I won't pretend I can design a robust OO initialisation mechanism for a hypothetical language in a couple of minutes, but as a starting point: C++ provides the useful concept of initialiser lists in class constructors, which specify expression(s) to be used to initialise each individual data member or base class, and if you're going to invent the concept of a sub-constructor, can't such special functions mimic the initialiser list concept and define the initialiser expressions for a subset of the data members and/or base classes subobjects? Then you can have a constructor delegate some or all of the initialisation to any of these subconstructors without breaking your general initialisation semantics, and if you want, you can default-initialise anything before you enter the body of your main constructor if it hasn't been addressed explicitly already.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    51. Re:Do we really need another D infomercial? by ZorbaTHut · · Score: 1

      I don't know about him, but I'd sure as hell want a compiletime error. The earlier your errors can show up, the easier they are to fix.

      --
      Breaking Into the Industry - A development log about starting a game studio.
    52. Re:Do we really need another D infomercial? by metamatic · · Score: 1

      The problem is that like most things in programming language design, there's a tradeoff. Insisting on static method signature checking at compile time, for example, means you can't dynamically extend objects at run time without a lot of awkwardness.

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    53. Re:Do we really need another D infomercial? by ZorbaTHut · · Score: 1

      That's true. Personally, that's not something I commonly want to do :) but I agree that it's a tradeoff.

      --
      Breaking Into the Industry - A development log about starting a game studio.
    54. Re:Do we really need another D infomercial? by lindquist · · Score: 1

      It seems to me (not having any experience in numerical analysis at all) that the crux of this whole discussion shouldn't be about 80bit float precision, but rather that D requires implementations to have the 'real' type map to the highest supported precision in the hardware.

  20. Re:Erm how is this better.. by tcopeland · · Score: 1

    > You might as well build native x86 code linked against
    > Windows libraries for all the portability you have.

    That's a good point. Still, the VM does serve as an insulating layer against OS changes. But Microsoft is pretty good about not breaking backwards compatibility, so that's not a great advantage. Any idea if there's a C# to native compiler out there? Googling around, I came up with this thing.

    The app I work on uses Ruby and Flash to be crossplatform; working out pretty well so far...

  21. Cargo cult programming by Anonymous Coward · · Score: 0

    "Its focus is on combining the power and high performance of C and C++ with the programmer productivity of modern languages like Ruby and Python."

    This may be half of it, but I would say a core part of its focus is something with enough curly-braces to be palatable to stubborn C and C++ programmers.

    I really hate banging this drum, but Lisp (the language that everybody who doesn't know loves to hate) has had for many years the high performance of C and C++ (through optimizing native compilers and profilers), and at least as much power and productivity as Ruby and Python (through even higher-level features, not the least of which are macros).

    I'm not saying this to be disrespectful to D. Apparently that's a big feature. A powerful homoiconic language that uses parentheses is a hard sell, because people will associate it with things they think are true about other languages that look like that. For example, they might think that it's interpreted (even though I've never seen a Common Lisp that wasn't compiled, and only one that doesn't compile to native code). OTOH, when they see braces, they might associate it with C/C++.

    It's 2007, and cargo cults are alive and well.

    1. Re:Cargo cult programming by Anonymous Coward · · Score: 0

      There's a lot more to being "C-Like" than curly braces. The big thing is that the assembly is right under the hood. Thats a good thing (easy linkage, easy debugging), and a bad thing because the stack as scope control, variable storage, and communication link is terribly fragile.

      Plus there is some value to the syntax. Clever tricks aside, the simple statement nature of c-likes makes transition easier for everyone who knows such a language already.

      I think the cult of lisp is at least as guilty as the cult of c of the sin of making syntax into a holy sacrement.

    2. Re:Cargo cult programming by Marsell · · Score: 1

      It's 2007, and cargo cults are alive and well.

      Yes, Common Lisp and its myriad dialects^Wvendors just never die.

      It would be nice if the Lisp community would finally stop with their tomfoolery and come up with one decent variant that is used and supported by everyone. Common things like threads, sockets, threads, connecting to databases, calling foreign functions... a less elistist and knee-jerk defensive community would help too.

      You'd think the Lisp world would have figured this out by watching Perl, Python, and now Ruby; garden-variety Lispers pride themselves on their brilliance after all.

    3. Re:Cargo cult programming by ciggieposeur · · Score: 1

      I expect you know all this already, but I feel I should post it for others following the thread...

      with one decent variant that is used and supported by everyone. Common things like threads, sockets, threads, connecting to databases, calling foreign functions...

      Real threads are in SBCL, Allegro, and (I think) ECL. Multiprocessing ala mcclim tends to work everywhere else. The Common Lisp Cookbook should have code for sockets, databases is generally CLSQL, and foreign functions is generally CFFI (the evolved version of UFFI).

      a less elistist and knee-jerk defensive community would help too.

      comp.lang.lisp is showing many signs of evolution away from the flamewars that engulfed it over the last decade or so. In the last two years a new gamut of sites dedicated to both doing exactly what you are asking for above (see the Lisp gardeners project) and making a lot of newbie-friendly documentation available have come up. I won't say it's perfect, but I think the message has gotten across that a new generation of Lispers are ready to do their part and the existing community is opening to them.

      I personally think Lisp is ready for another book that includes what you are asking for: network code, threads, FFI, SQL, ASDF, GUI, webapps, XML, crypto, and a section on specifically installing on both Windows and Unix at least the currently-major implementations (CLISP, CMUCL, SBCL, ECL, Allegro). Call it "_Really_ Practical Common Lisp" and have it produce one typical desktop application and one web application. Given that book, CL would probably become much more popular quickly.

    4. Re:Cargo cult programming by Marsell · · Score: 1

      Real threads are in SBCL, Allegro, and (I think) ECL. Multiprocessing ala mcclim tends to work everywhere else. The Common Lisp Cookbook should have code for sockets, databases is generally CLSQL, and foreign functions is generally CFFI (the evolved version of UFFI).

      Yes, it's true that most dialects include many or all of these things. It'd just be nice if all of them worked seamlessly together, no matter which compiler is used.

    5. Re:Cargo cult programming by Anonymous Coward · · Score: 0

      I know Lisp. I know it very well in fact. It's a very powerful language but the syntax still sucks.

      The problem is not that the language isn't elegant or powerful or whatever, it's simply that the syntax isn't human friendly. Using a single deliminator and not distinguishing between data and code are elegant and simple but forever flawed concepts.

      Trust me, if Lisp was so great it would be way more popular than it is. It's one of the oldest languages around so it has had plenty of time to be accepted if it was ever going to be accepted. Again, the problem is not that the language isn't powerful enough or whatever. Syntax is how we as programmers interface with the language and it needs to make sense in a human-friendly way.

    6. Re:Cargo cult programming by DropArk · · Score: 1

      I maintain that the primary purpose of a programming language is to help people communicate amongst themselves, the implementation of a computer-based solution or algorithm. They exist to help people not machines. If a given syntax fails to do that, then it is not a good programming language.
      From appearances, Lisp and C++ both fall short of being a good way help people read and understand a specific problem's implementation - regardless of how robust and accurate that implementation is.

  22. Re:Erm how is this better.. by spitzak · · Score: 0, Flamebait

    What language is the VM written in?

  23. Re:Erm how is this better.. by Anonymous Coward · · Score: 0

    Your kidding right?

    Right?

  24. Re:Erm how is this better.. by Anonymous Coward · · Score: 0

    At least two platforms, X86 32 bit and X86 64 bit, and I think, Itanium (not so sure).

    The reason why not shared library is the whole 'machine code generation' being different for different platforms. Sure, MacOS has universal binaries, but it does mean double the exe size and can't cope with new platforms coming out, or processor specific optimisations. (I belive the .Net framework will use MMX registers sometimes if they're available, for example.)

  25. Lazy Questions by Quantam · · Score: 2, Informative

    Looking at the comparison lists, D looks pretty nice. It has a lot of features that I'd consider switching languages for (from C++), but any such language would have to have a few particular properties (due to the kinds of things I program):
    1. Must be able to disable garbage collection and manage allocation explicitly
    2. Must be able to allocate classes on the stack
    3. Must minimize use of exceptions in the standard library (in other words, exceptions must only be used for exceptional cases)

    Java fails all of them, if I recall correctly (I don't know that much about Java, actually). C# fails 2 and 3. It looks like you can disable garbage collection in D, but in the comparison list I didn't see mention of 2 or 3. Does anybody know, off the top of their head?

    --
    You have tried to support your argument with faulty reasoning! Go directly to jail; do not pass Go, do not collect $200!
    1. Re:Lazy Questions by kihjin · · Score: 1

      These may satisfy your curiosity:
      1. You can disable GC entirely, on a per class or per instance basis.
      2. Yes, stack classes are easy.
      3. I haven't used Phobos in great detail yet, but I haven't encountered anything like Java's exception library.

      Hope this helps,

      KG

      --
      This slashdot-related signature is a stub. You can help kihjin by expanding it.
    2. Re:Lazy Questions by Marsell · · Score: 1

      1. Must be able to disable garbage collection and manage allocation explicitly

      Yes, using std.gc.enable()/disable(): http://digitalmars.com/d/phobos/std_gc.html. You can still use malloc and friends, even while GC is active.

      2. Must be able to allocate classes on the stack

      Yes, using the scope keyword: http://www.digitalmars.com/d/memory.html#raii

      3. Must minimize use of exceptions in the standard library (in other words, exceptions must only be used for exceptional cases)

      Exceptions are common in the standard library. All the ones I have seen seem only for exceptional cases. Define exceptional?

    3. Re:Lazy Questions by Sterling+Christensen · · Score: 1

      1. Must be able to disable garbage collection and manage allocation explicitly You can explicitly disable the garbage collector with a function call. The C standard library is exposed, and malloc/free work fine in D. I think there's even an unofficial no garbage collector version of the D standard library you could use.

      2. Must be able to allocate classes on the stack Just declare the class as a struct. You can still put public/private/etc member functions in it (like a class) but it will go on the stack.

      3. Must minimize use of exceptions in the standard library (in other words, exceptions must only be used for exceptional cases) Yeah... there is at least one alternative standard library, you don't have to use phobos.
    4. Re:Lazy Questions by TheRaven64 · · Score: 2

      2. Must be able to allocate classes on the stack

      This is a really, really strange requirement. Why would you need to be able to do this in a language? In a high-level language, memory allocation is abstracted away from you so you don't need to worry about it. A decent JVM, for example, creates pools for frequently allocated and de-allocated objects so that they have a much lower cost than heap-allocation of C++ objects.

      Objective-C, for another example, follows the Smalltalk model of putting as little in the language and as much in the libraries as possible. When you +alloc an Objective-C object, it actually calls the +allocWithZone: method with the default zone for that object type. If you want to create and destroy objects quickly, you can create a special zone for them, allocate a big block of memory all at once, and then use that. This approach was used heavily by NeXT, who wrote a windowing system, device drivers, and a suite of applications that ran quite happily on a 25MHz Motorola 68K chip.

      It basically sounds like you're saying 'I want to use a language that is exactly the same as C++, but isn't C++.' My advice to you is learn Lisp, Smalltalk, Erlang and Haskell, and then evaluate languages. It doesn't sound like you are sufficiently comfortable with different programming models to be able to comfortably switch languages to one that is actually different.

      --
      I am TheRaven on Soylent News
    5. Re:Lazy Questions by Carewolf · · Score: 1

      Same reason you would disable garbage collection. To keep tight memory-management and keep all optimization options in the hands of the programmer, because so far no compiler beats a good C/C++ programmer (yes, I know the beat bad ones, but you have Java and C# for all the lazy and bad programmers out there).

    6. Re:Lazy Questions by Anonymous Coward · · Score: 0

      You sound like a novice programmer. Real professionals want to get the job done as quickly and robustly as possible, and writing in C++ rarely accomplishes that. Saying that Java and C# programmers are 'lazy' and 'bad' just proves that you've never taken the time to learn these programming languages. A real professional learns several of the mainstream programming languages and chooses the right one for the job, which in many cases means using the one that interfaces best with existing code bases. And by the way, I do most of my professional programming in C++, so I'm not one of those 'lazy' or 'bad' programmers you imagine the world is full of.

  26. GC, No Vm or performance hit by StrawberryFrog · · Score: 1, Insightful

    garbage collection ... No virtual machine

    How do they square that particular circle?

    native code speed

    Just In Time Compilation in C# or Java has "Native code speed", in fact it goes one better - since the compilation happens at a later time, more processor or other specific optimisations can be made. That's not the slow part. GC has a lot to do with the perceived slowness. Isn't it disingenuous to tout both "native code speed" and "garbage collection"?

    --

    My Karma: ran over your Dogma
    StrawberryFrog

    1. Re:GC, No Vm or performance hit by Nasarius · · Score: 3, Informative
      garbage collection ... No virtual machine How do they square that particular circle?
      It's really not that difficult. Hans Boehm wrote a garbage collector for C/C++ years ago, which happens to be the same one that the Digital Mars implementation of D uses.
      --
      LOAD "SIG",8,1
    2. Re:GC, No Vm or performance hit by Anonymous Coward · · Score: 0

      GC has a lot to do with the perceived slowness.

      So like, it's not _really_ slow, we just "perceive" that it's slow -- when actually it's, like, really really fast, right?

    3. Re:GC, No Vm or performance hit by Anonymous+Brave+Guy · · Score: 4, Informative

      garbage collection ... No virtual machine ... How do they square that particular circle?

      The same way as countless other programming languages have in the past, I imagine. Why do you think garbage collection requires running your code under a VM?

      Just In Time Compilation in C# or Java has "Native code speed", in fact it goes one better - since the compilation happens at a later time, more processor or other specific optimisations can be made.

      Of course, you're overlooking all the overhead of monitoring the code long enough to determine which on-the-fly optimisations are worth performing, and of compiling the code itself, neither of which is trivial.

      GC has a lot to do with the perceived slowness.

      True, though of course it's not without overheads. Almost all of the Big Claims(TM) made by GC advocates in these discussions come with a catch: state-of-the-art GC method number 17 has a lower amortised cost of memory recovery than explicitly freeing it C-style!*

      * But only if your system contains 10x as much memory as the program will ever need anyway.

      This is traditionally followed by a wisecrack about how memory is cheap, followed by three enlightened posters pointing out the stupidity of that argument for multiple reasons. :-)

      Isn't it disingenuous to tout both "native code speed" and "garbage collection"?

      That depends a lot on context. If you really have a system where the overheads of GC are trivial but all the advantages are present, it seems a fair claim. It's just not likely to be universally true, and representing it as such would indeed be disingenuous.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    4. Re:GC, No Vm or performance hit by StrawberryFrog · · Score: 1

      Every time someone posts on here that they perceive java as slow, they get jumped on. I wouldn't know the reality, It's been a while since I used some java, but the perception is real.

      --

      My Karma: ran over your Dogma
      StrawberryFrog

    5. Re:GC, No Vm or performance hit by scoonbutt · · Score: 2, Informative

      Garbage collection has no requirement for using a virtual machine. They usually show up together, but there's no technical requirement.

    6. Re:GC, No Vm or performance hit by StrawberryFrog · · Score: 1

      The same way as countless other programming languages have in the past, I imagine. Why do you think garbage collection requires running your code under a VM?

      Because in a non-vm language like C with its use of pointers for everything, it is very hard if not impossible to tell if an object on the heap is in fact still in use and can not be automatically reclaimed. Sure you could have a Vm with pointers, but one of the main advantages of the Java or .net VM is that it can better track memory use.

      --

      My Karma: ran over your Dogma
      StrawberryFrog

    7. Re:GC, No Vm or performance hit by Nasarius · · Score: 1

      The perception is quite valid if you use a Java GUI app. Eclipse and Azureus are really cool, but their interfaces are incredibly sluggish. Compare this to, say, wxPython or Tcl/Tk (interpreted languages using a native C or C++ library), which run GUIs just fine.

      --
      LOAD "SIG",8,1
    8. Re:GC, No Vm or performance hit by StrawberryFrog · · Score: 2, Interesting

      If I read that FAQ right, it is possible that "integer or other random data be misinterpreted as a pointer by the collector" since given the nature of C - no VM, the difference between a pointer and an int is at best a gentleman's agreement - anything in memory *could* be a pointer. Well, I suppose it works if he says so. But it certainly isn't pretty.

      --

      My Karma: ran over your Dogma
      StrawberryFrog

    9. Re:GC, No Vm or performance hit by bockelboy · · Score: 1

      Most of the Java-related speed problems fit in one of three categories:

      1) VM start-up time.
      2) Over-architecting objects. OO languages tend to encourage you to make everything into an poorly-designed object. If you are doing numerical work and you end up creating millions of objects, your doing something wrong.
      3) Crappy GUI libraries. Makes the UI miserable for many people (it is getting better, but slowly). If this is your interaction with Java, I understand your dislike for it.

      If you apply the language to well-architected server programs, it's great.

    10. Re:GC, No Vm or performance hit by Watson+Ladd · · Score: 1

      Haskell has garbage collection and no VM.

      --
      Inventions have long since reached their limit, and I see no hope for further development.-- Frontinus, 1st cent. AD
    11. Re:GC, No Vm or performance hit by Anonymous Coward · · Score: 0

      I really cannot understand how you managed to be so stupid. Most languages that have garbage collection do not make use of virtual machines, and in fact keep track of pointers in the same way that a virtual machine's garbage collector does. The difficulty with garbage collecting C has to deal with the type of pointers it supports, and is not a weakness that other native-code languages have. In C you are burdened to use conservative garbage collection (which may leak some memory) but that means nothing to the rest.

      The advantages of the virtual machine are portability and security; the nature of garbage collection is determined by pointer semantics.

    12. Re:GC, No Vm or performance hit by rbarreira · · Score: 1

      Doesn't sound neither pretty or optimal from a performance point of view, but regarding those points I admit that it might be good enough.

      The real problem might be false negatives: memory containing garbage not getting freed due to something appearing to point at it, without actually being a pointer?

      --

      The AACS key is NOT 0xF606EEFD628B1CA427BEA93A9CA9773F
    13. Re:GC, No Vm or performance hit by rbarreira · · Score: 2, Interesting

      Here is something that I found about this. Not very good news for conservative garbage collection, I say...

      --

      The AACS key is NOT 0xF606EEFD628B1CA427BEA93A9CA9773F
    14. Re:GC, No Vm or performance hit by fish+waffle · · Score: 2, Interesting
      The real problem might be false negatives: memory containing garbage not getting freed due to something appearing to point at it, without actually being a pointer?

      In theory yes, but in practice not very much; conservative gc works very well in most cases. The main drawbacks are:
      • No guarantee that any given bit of memory is collected. As mentioned in practice it's not typically much of an issue, but if you're developing a critical application riding close to the memory limit this may be a concern.
      • Memory fragmentation can be a problem for some long running programs.

    15. Re:GC, No Vm or performance hit by WalterBright · · Score: 2, Informative
      Hans Boehm wrote a garbage collector for C/C++ years ago, which happens to be the same one that the Digital Mars implementation of D uses.

      While Hans Boehm has written an excellent GC, it has no relationship with D's GC. The complete source to D's GC (which is written 100% in D) comes with D, and you can check it out for yourself.

    16. Re:GC, No Vm or performance hit by Anonymous Coward · · Score: 0

      I can see that you don't know very well C/C++

      You have no idea how fast C/C++ can be. no one that knows both languages very well will claims that.

      Its illogical to think that a high level language will outperform a low level language in performance. it is almost ridiculous.

      Let me put in this way, How can you improve you java application to use MMX or SSE2 cpu extensions? or... how can i optimize my code to fit under the processor cache? or how do i tell the cpu to prefetch a memory?

      if you are a C/C++/Assembler program, you may know... but if you a high level language programmer you dont!, so please.. dont EVER say that a high level language can have the same speed as a low level program..

      it is not the question if java can be compiled as native code... in fact it can, but the VM in embbed inside the executable, and it will have layers and layers above the real assembly code.

    17. Re:GC, No Vm or performance hit by StrawberryFrog · · Score: 1

      Haskell, if a recall correctly, does not rely heavily on pointers.

      --

      My Karma: ran over your Dogma
      StrawberryFrog

    18. Re:GC, No Vm or performance hit by StrawberryFrog · · Score: 1

      You have no idea how fast C/C++ can be. no one that knows both languages very well will claims that.

      This is a typical C++ programmer attitude. C++ can be faster or as fast as other approaches, and it can be free of the memory leaks, access violations and assorted other pointer error to which it is prone. The problem is, it very seldom is.

      There are of course cases where a low-level bare-metal language like C/C++ is just the thing - e.g. Os'es, Device drivers, Virtual machines. However in many other cases using C/C++ is not generally a good thing. This is not just my opinion, look at IT jobs listings sometime.

      dont EVER say that a high level language can have the same speed as a low level program.

      In some cases, it can. In some cases, the compiler does a better job of optimising than a person. And in many other cases, the compiled high-level code is slower, but by a fraction that is totally insignificant compared to the increased ease of producing the code.

      --

      My Karma: ran over your Dogma
      StrawberryFrog

    19. Re:GC, No Vm or performance hit by StrawberryFrog · · Score: 1

      Of course, you're overlooking all the overhead of monitoring the code long enough to determine which on-the-fly optimisations are worth performing

      Except sometimes there is no overhead to optimising: Simply use the appropriate compiler for your CPU's feature set. E.g 64-bit or SIMD machine code could come out at no extra cost.

      --

      My Karma: ran over your Dogma
      StrawberryFrog

    20. Re:GC, No Vm or performance hit by Anonymous Coward · · Score: 0

      ...the point being that there are _many_ languages that don't rely on pointers while still being suitable for native code compilation: Common Lisp, Ocaml, ML, Clean, Scheme, even Smalltalk - if you try hard enough, as the author of Smalltalk/X did.

    21. Re:GC, No Vm or performance hit by discord5 · · Score: 2, Funny
      This is traditionally followed by a wisecrack about how memory is cheap, followed by three enlightened posters pointing out the stupidity of that argument for multiple reasons. :-)

      Let me help you with this :

      Ha! Memory is cheap!
      So was your mother last night.

      Dad?

      Meh, karma to burn...

    22. Re:GC, No Vm or performance hit by master_p · · Score: 1

      Is D's garbage collection multi-threaded? in versions of Java prior to 6, the allocation routine has to synchronize access to the garbage collector's context because it is invoked from many different threads. In Java 6, each thread has its own garbage collector context, thus avoiding critical region locking/unlocking.

    23. Re:GC, No Vm or performance hit by shenanigans · · Score: 1

      This has more to do with compiler implementation than with language features. Walter Bright has stated that a more "type-intelligent" GC will be implemented later.

    24. Re:GC, No Vm or performance hit by StrawberryFrog · · Score: 1

      But isn't "type-intelligent" GC difficult in a language that isn't? And languages that are C-compatible aren't, by definition. If there is little difference between an int and a pointer, how "type-intelligent" can the GC be?

      --

      My Karma: ran over your Dogma
      StrawberryFrog

    25. Re:GC, No Vm or performance hit by Anonymous Coward · · Score: 0

      Hey stupid, read the topic!!! i'm talking abou PERFORMANCE.

      i'm not saing that C++ if better for everthink. but is better for performance. as assembly would ourperformance C/C+.

    26. Re:GC, No Vm or performance hit by Anonymous Coward · · Score: 0

      The compiler will do better than a human?.. that's why today programmers SUX.

      sure the compiler can do amazing stuffs, but it is no magic. it will not shrink magically you code to fit under cache processor, or known if he must use SSE2 to to string comparations. or know when its worth to use the stack or alloc memory by itself... there is some things that requires some kind of inteligence beyound the compiler capabilities.

      if you really think that java can have the same speedy as C/C++, search the numbers,, how many games are in java? how many 'utils' of unix are made in java? my /usr/bin have 1780 files. none in java.
      why the guys of setiathome dont do their projects in java?
      how many applications in java are you executing right now? ( i have 2 java programs ( azureus and eclipse ), eating 400M of ram. and 110 C programs running on my machine ) eating 50M of ram

      for those who defend java agains c++ PERFORMANCE, do you guys even know what is MMX, SSE2, prefetch, cpu cache?

      sure. there are reasons where you run java. i really like that language. but dont come and say that in performance both are equals.

    27. Re:GC, No Vm or performance hit by Anonymous Coward · · Score: 0

      Boehm's GC is a conservative collector because he was stuck with C's object semantics.

      A precise collector can always tell when it is looking at a pointer into the managed heap. This means that it can always prove the liveness of any object in the managed heap by tracing pointers from a well-known set of roots.

      When objects are proven live, they are retained; when they are proven dead, their memory can be reused as soon as one wants.

      Non-precise collectors have to be more conservative in their retention, since they cannot prove the liveness of all objects. This can be because a live object contains data that might be a pointer into the managed heap, or because "foreign" (i.e., unmanaged) pointers may exist and be used to reach an object in the managed heap. Both of these may happen in C.

      Consequently, Boehm's GC (a) will retain data that is actually dead, because it is not provably dead -- this is a leak, and (b) cannot move live objects that may be pointed to by an unmanaged pointer.

      C's pointer semantics and type-punning make the language incompatible with a precise collector.

      Modificiations to C's object semantics and elmination of some type-punning, on the other hand, would make it possible. (In fact, this has been done several times). In particular, word-aligning all objects (including chars) would result in all C pointers having zeros in one or more lower-order bits. Making sure non-pointer objects all had 1 in the lowest-order bit would allow for a precise GC, at the cost of boxing and unboxing all non-pointer objects. (In some architectures with ample registers, "shift and fill" is surprisingly cheap computationally) and a reduction in the precision of all non-pointer objects. Sacrificing a second tag bit also allows for easier collection, relocation and compaction of pseudo-objects like C strings, arrays and structures.

      By way of illustration, looking at the content of an arbitrary word, least significant bit to the right: .... 0 == this is a pointer to a managed object .... 1 == this is an immediate integer (shifted left one bit and 1-filled).

      Other "tag" bits could distinguish other word-sized immediate objects, which could be useful for type safety or other reasons, or pointers to "headered objects" in specialized aggregate-object heaps. These would be strings or arrays (the header would indicate the length of the object) or C-style structs.

      Unfortunately, this is considered too costly by most "bare metal" C coders, and still does not make C especially attractive to most people comfortable with automatically managed heaps to abandon languages which have been designed with precise garbage collection in mind.

      Moreover, dilligent use of a conservative GC system (especially when the dilligence is facilitated by a compiler) will mitigate most leaks and lead to fewer mistakes than expected in programs that rely upon explicit/manual memory management or reference counting.

    28. Re:GC, No Vm or performance hit by TemporalBeing · · Score: 1
      Of course, you're overlooking all the overhead of monitoring the code long enough to determine which on-the-fly optimisations are worth performing
      Except sometimes there is no overhead to optimising: Simply use the appropriate compiler for your CPU's feature set. E.g 64-bit or SIMD machine code could come out at no extra cost.
      That depends on what kind of optimizations you want to be doing. If you are doing static optimization - then yes it is at no extra cost to compiling, however, then it kills your compile time. If you are doing dynamic optimization then it comes at cost to your run time. Either way, optimization is a killer in a VM or JIT environment and compiling can be doubly so depending on what kind of optimization you are doing. Nothing is free.

      The nice thing about non-VM/JIT languages is that you get the optimization at compile time and can get as deep as you like, which is of no concern to the end-user as the program is not being compiled on the fly (JIT or otherwise) for the user so the program will be consistent in speed all the time, not just after a few minutes while it compiles itself or after enough time that it has had the ability to optimize itself for your current use, which could be erratic enough as to worsen the overall use of the program depending on your use of the program.

      VM's & JIT languages, OTOH, suffer performance when they are compiled or optimized. If the optimization is at compile time, then it takes that much longer for the user to be able to run that part of the program. Sure the user may not hit it often, but it hurts that much more when they do. Alternatively, the program will gradually increase in optimization as the program runs, thus it will take a long time (cycle wise at the very least) for the program to run at its peak. Sure, the program comes up, but the user will have to wait for the unoptimized program to be optimized before getting the true experience of the program - if they ever really use it long enough, which they might not; and if their usage is erratic enough while running the program (e.g. not performing the same tasks enough) then the program will remain in a degraded performance all the time. In either case, you will likely turn users away from the program because it will seem sluggish at best for a while when compared to a pre-compiled, pre-optimized program that just starts and runs full-blast.

      I'll take Ada, Cobol, Pascal, Modulus, D, C, C++, ObjC, and others over .Net or Java any day, and my computer will be better for it.
      --
      Truth is like the sun. You can shut it out for a time, but it ain't goin' away. - Elvis Presley (source: imdb.com)
    29. Re:GC, No Vm or performance hit by Anonymous Coward · · Score: 0
      I think it would be reasonable to bet that in most cases the best optimization opportunities lie in the choice of algorithms with better time complexity rather than any optimization of an algorithm with worse time complexity, automatic or manual.

      That is, the speedup from an appropriate selection of a data structure and functions which operate on it will usually far outweigh the slowdown from a suboptimal choice of implementation language or a suboptimal choice of specific compiler/interpreter (or compiler options).

      Moreover, people with many anecdotes about how much slower their programs are in one language (or compiler environment) than another probably have chosen algorithms with highly non-linear scaling properties, with the knee (or hockey-stick bend if you prefer) shifting slightly depending on the specific choices of compiler/run-time environment/etc.

      Usually such anecdotes are accompanied with an assertion as bald as:

      dont EVER say that a high level language can have the same speed as a low level program


      which ignores the issue of algorithmic time (and space) complexity entirely.

      Finally, higher level languages typically have advanced datatypes and extensive pre-written libraries to manipulate them efficiently, as part of the base language. Many poor choices of algorithm involve reinventing these (or very similar) abstractions in less efficient ways, or trying to do everything by hand without them.

    30. Re:GC, No Vm or performance hit by rbarreira · · Score: 1

      As mentioned here, it's possible for conservative GC to ignore a whole linked data structure such as a queue, which can be arbitrarily big, just because of a single non-pointer position in memory.

      I agree that it's not likely, but I just don't feel good by using such an inelegant and disaster-prone technology in my programs! Maybe I'm irrational, maybe I'm a purist, maybe a bit of both, but I just don't like the idea.

      Plus, when I heard that the D programming language uses it, my opinion on the language also decreased.

      --

      The AACS key is NOT 0xF606EEFD628B1CA427BEA93A9CA9773F
    31. Re:GC, No Vm or performance hit by DonVictor · · Score: 1

      Yes, but D knows what type an object really is most of the time. You don't need to be type intelligent for every object in order to benefit. For unknown areas of memory, you can use conservative semantics. This will prevent some kinds of compacting collectors, but it's not fatal.

      In D, you know a lot more about what areas of memory have what type of object. You could do this in C++, but most of the libraries and existing code is not written this way. People who write D libraries know that you can't do GC-unfriendly things. In C++, noone expects a GC to be attached when designing an STL implementation or similar.

  27. Re:Erm how is this better.. by pdbaby · · Score: 1
    You might as well build native x86 code linked against Windows libraries for all the portability you have

    I don't think that portability's a feature of .NET... I think that its great runtime safety checks & logical std library are the major thing it brings to the table.

    The portability thanks to Mono's just an added benefit for some of us

    --
    Global symbol "$deity" requires explicit package name at line 2. - If only $scripture started "use strict;"
  28. What about DTraces' D Language by otomo_1001 · · Score: 1

    I thought for sure that the D language was at least 25 years old and built way back when. Then about 2 years ago Solaris 10 came out with dtrace and all of the "scripts" have .d extensions. Yeah I know it is unix and the extensions are meaningless.

    Dtrace user guide

    But the disambiguation page on wikipedia seems to bear out that calling a programming language D will only be interesting. Anyone know if it is trademarked yet?

  29. No decent XML parser by Anonymous Coward · · Score: 0

    I really like D, but it has a one huge shortcoming: no decent XML parser or generator library. Nowadays parsing and generating XML is a very commong task. It makes hard for D to compete against Java or #C.

  30. It's right there in your post by Weaselmancer · · Score: 1

    "No Virtual machine"... -that is a HUUGE downside not upside .Net is fairly well performing for example

    "Fairly well". Me, I'd rather have good. Or exceptional. What you're describing there is "marginal", and that's an excellent reason to steer clear of .NET.

    --
    Weaselmancer
    rediculous.
    1. Re:It's right there in your post by hao2lian · · Score: 2, Informative

      Shoehorning his adjectives doesn't change the facts: .NET is damn fast. Perhaps not "I need to raytrace downtown Manhattan." fast, but certainly fast for web services, desktop applications, mobile apps, and Windows PowerShell. Heck, it even beat out a C++ app where low-level usually succeeds--lifting big data structures--until Raymond Chen wrote his own allocator.

      http://blogs.msdn.com/ricom/archive/2005/05/19/420 158.aspx

      --
      Pelé!
  31. The feature-checklist school of software design... by stevenj · · Score: 4, Insightful
    ...is obviously the birthplace of D. Heavens, it's the union of C++ (already a nightmarishly huge language), C99, and C#, along with dozens of other features halfway borrowed from functional languages and other inspirations. More features must be better, never mind that the language becomes insanely complicated! (Next they'll be throwing in the Fortran 2000 standard.)

    My feeling is that languages shouldn't try to satisfy all possible needs. Rather, we should have small and clean languages, use the right tool for each job, and combine code libraries from different languages when needed. (I regularly use 3-6 languages in a single project and my life is much happier for it.)

    (Legacy support is critically important too, but it is vastly better to provide legacy support by providing ways to call older languages, especially the lingua franca of C, rather than demanding that the new language be a superset of the old. I still call numerical libraries written in pre-1970 Fortran, but that doesn't mean I have to write my code in a Fortran derivative.)

    --
    If a thing is not diminished by being shared, it is not rightly owned if it is only owned & not shared. S. Augustine
  32. Python and D by MightyMooquack · · Score: 4, Interesting

    One area I see D being useful in is integration with Python. Writing to the raw Python/C API is cumbersome. (Managing reference counts is tedious.) Boost.Python is difficult to build and slow to compile. I've written a library for D called Pyd, whose purpose is not entirely unlike Boost.Python's.

    Pyd is easy to use. It provides its own extension to Python's distutils. Usually, you just need to make sure the D compiler is on your PATH, write a setup.py file, and run python setup.py build.

    "Hello world" in Pyd looks something like this (and I apologize for the lack of indentation):

    import pyd.pyd;
    import std.stdio;

    void hello_func() {
    writefln("Hello, world!");
    }

    extern (C) void PydMain() {
    def!(hello_func);
    module_init();
    }
    1. Re:Python and D by Nasarius · · Score: 1

      Good stuff. Alas, I see you inherit the necessity for FooWrap classes for polymorphism from Boost.Python. Is there any way of doing this automatically, or am I doomed to wrestling with SWIG?

      --
      LOAD "SIG",8,1
    2. Re:Python and D by MightyMooquack · · Score: 1

      There's no way that I can see to do this automatically.

      The concern is this (reposted here so people don't have to dig through Pyd's docs):

      class Foo {
          void bar() { writefln("Foo.bar"); }
      }

      void func(Foo f) { f.bar(); }

      When we wrap this class and this function with Pyd (or Boost.Python), we can subclass Foo with a Python class:

      class PyClass(Foo):
          def bar(self):
              print "PyClass.bar"

      The behavior we want is:

      >>> o = PyClass()
      >>> func(o)
      PyClass.bar

      However, there's no way to get the D function to polymorphically call the Python subclass's method without user intervention. I cannot generate the required wrapper with templates alone. Therefore, users must write thin wrapper classes in D, and expose the wrappers to Python:

      class FooWrap : Foo {
          mixin OverloadShim;
          void bar() {
              get_overload(&super.bar, "bar");
          }
      }

      get_overload performs a bit of magic, checking if the current object is an actual instance of FooWrap or a Python subclass, and calling the proper method as appropriate.

      In the dim and distant future, I may be able to generate code like this in a SWIG-like fashion. D is remarkably easy to parse (perhaps one of the language's strongest advantages over C++), and I have almost completed a D parser written in Python (using Pyparsing). Since Pyd's build utility is written in Python, doing this kind of trickery shouldn't prove too difficult.

    3. Re:Python and D by Game_Ender · · Score: 1

      You should check out Py++ it provides more automation than SWIG with the easy of integration between Boost.Python and C++.

    4. Re:Python and D by newt0311 · · Score: 1

      I would advise looking at pyrex. It is designed for integrating C and Python and IMHO does a pretty good job of it.

    5. Re:Python and D by mav[LAG] · · Score: 1

      Lovely stuff. Is code that uses libraries such as Derelict usable from Pyd without running into thread lock issues? It would be great to write a games engine in D and call it from Python a la Pygame.

      --
      --- Hot Shot City is particularly good.
  33. Re:Erm how is this better.. by Curate · · Score: 1
    There is only one full implementation of .Net (the MS one), and it runs on a single platform (Windows on x86).


    Not quite correct. The .NET runtime is available for all Windows architectures: x86, x64, and ia64.

  34. Re:Erm how is this better.. by Heembo · · Score: 2, Informative

    In .NET it's called a Common Runtime Library, running MSLI code. (That sentence is analogous to "the Java Virtual Machine runs Bytecode"

    The big win in .NET is that there is built-in administrator controllable security (even pub/priv key security) between the CRL (or vm to you) and the internal .NET framework. In fact, there are several administrative controllable hooks built into the .NET framework that we just do not see in Java and Ruby and the others. This is the feature that separates .NET from the rest, and the rest of these frameworks are working to catch up. All modern languages are or should be moving into this direction. I predict that in 5 years the ONLY way you will be able to code to the WinOS is via the secure API that is .NET. (Assuming your programmers and admin teams understand .NET very well!)

    .NET is horrible at scaling (less you got a big hardware budget), so I see .NET all over the DoD and internal sites, but not so much for full-in internet sites where Java is winning in the top 10 (example, MySpace is a Java app).

    --
    Horns are really just a broken halo.
  35. Is anyone ... by compandsci · · Score: 2, Funny

    ... actually going to use this? I think I'll wait for D++

    1. Re:Is anyone ... by azureice · · Score: 1

      Alreay exists: http://www.pagemac.com/dpp/ :x

    2. Re:Is anyone ... by truckaxle · · Score: 1

      ...and I am going to wait for D#

    3. Re:Is anyone ... by yosofun · · Score: 1

      i'd wait for Z#

  36. IDE D's Language Features by trimbo · · Score: 2, Funny

    I just can't see why I'd want to switch to a language that has no IDE support and is evolutionary to C# or C++. I hardly have to look at documentation for APIs anymore because I can just use Visual Studio's autocompletion to figure things out.

  37. What Is The Point? by Anonymous Coward · · Score: 0

    Am I really the only one who has yet to find a good reason to switch from Algol?

  38. Re:Another 'Toy' Programming Language by eneville · · Score: 1

    Yay, yet another 'toy' programming language, joining the likes of Java, Ruby, Python, and the reset of the bunch.

    Suitable I should think, for "I.T" projects, cobbled together by cable-pullers, thinking they are actually programmers.

    I'll stick to languages that have at least a professional following, in use by real software engineers (that is, engineers who can legally call themselves engineers), not the run of the mill code monkeys. what do you mean toy programming languages? java is almost identical to c#, give or take some rather small things. would you classify visual basic as a toy, i certainly do? or even pascal, but look a little deeper and pascal executes and compiles faster than c. how can you call a language a toy, it's a tool. if you cant work out what tool is best for a job then you probably do not have good enough experience with that job to know.
  39. Lies about productivity by Cafe+Alpha · · Score: 1

    You can't claim the productivity of dynamic languages without being one. "with the programmer productivity of modern languages like Ruby and Python."

    This is a lie.

    The productivity of those languages come from:

    1. Duck typing, ie no time spent (by the programmer) coming up with class and type hierchies that will support all future behavior of the product. You can make it up as you go along without ever hitting an, oops it isn't possible-and-I-have-to-refactor wall.

    2. Dynamic meta-programming - at least in Ruby (I'm not familiar with Python), you can change classes, add/change function etc. at run time.

    Some things more complete dynamic languages have, (but I'm not sure about current versions of the mentioned ones) is dynamic debugging where you can change the code (completely - including class definitions) while debugging, save the state of the whole program to continue from later (or debug from later), etc. etc. - advance debugging that C like languages don't have. Related advances, persistant data and the ability to make processes persistant (not just data).

    1. Re:Lies about productivity by Cafe+Alpha · · Score: 1

      By the way, there is a push to make a fast dynamic language (this is done by an inlining JIT that takes type statistics at run time and adapts the code while its running).

      See: http://www.strongtalk.org/

    2. Re:Lies about productivity by Jerf · · Score: 1

      Python and Ruby both have roughly equivalent technical capabilities for what you call "dynamic metaprogramming".

      The difference is that the Python community has a cultural value that says it's a bad idea and to be used only as a last resort, where Ruby folk seem to reach for it as a matter of course.

      I am fairly certain this is a maturity thing, and I confidently predict that the Ruby community will come to view their zest for monkeypatching as a mistake in a couple of years. Ruby isn't the first language to allow it, and it's not going to have the first language community to discover just how miserable it can make your life.

      If you're a Ruby programmer, I recommend you just skip this learning experience, and learn to start writing subclasses of built-in types when you need more functionality.

    3. Re:Lies about productivity by Anonymous Coward · · Score: 0

      Thank you very much, but nope, I'm going to stick with this because this is one of the top reasons why I started using Ruby in the first place. Why let VisualWorks programmers eat the whole cake themselves?

    4. Re:Lies about productivity by Jerf · · Score: 1

      Great. Have fun. I won't try to talk you out of it.

      But I will suggest that you keep your eyes peeled for when this causes you problems. If you never encounter it, hey, great, laugh at the arrogant prick on Slashdot. But if you do, you'll be better for having been sensitized to the problem, and seeing it more easily and sooner.

      Maybe you'll come up with a better solution than keeping your namespaces nicely separated, but at the very least at least you won't be blindsided.

  40. It's the libraries, stupid by istartedi · · Score: 1

    I skimmed it, and some of this stuff is a PiTA. For example, they make a lot of good points about the pre-processor, but I can't justify re-working all my code into D just from that alone. Some of this stuff is bells and whistles--e.g., the built in unit testing? You don't need a language construct for that. If your programmers are so lazy or stupid that they can't write unit tests in C or C++, having the language give them a little hand-holding, standard way of doing that is probably not going to help.

    If I need classes (and usually I don't), I'd reach for C++

    The real reason C and C++ are becoming less the language of choice? It's the libraries, stupid. Most of the new languages have extensive "standard libraries" that keep up with the modern world. C gives you the choice of linking anything, and I think the standard bodies refuse to endorse a wider ranging standard library because they don't want people to get the idea that you can only use a particular set of libs. The other reason of course is that they have better sandboxing and/or exception handling (Java still crashes, but it throws an exception instead of just dumping core or doing something else that's compiler dependant).

    While D makes some valid points, they might be better off adding these features to C++ and C compilers, and ultimately converging the two standards. It'd take a long time, but it was 9 years between the revisions of C (the last major one being C99). These language standards move at a glacial pace, and we like it that way!

    Something like D seems to offer neither the RAD approach of PHP, Ruby, etc. It doesn't seem to offer the backwards compatable standards track offered by a revision to the C or C++ standards either. It doesn't satisfy the "roll a script fast" crowd, or the "write code that will still be used 30 years from now" crowd, in any particular way. It looks lost in the middle. Unless it gets endorsed by a huge corporation, and I end up working for that corporation, or until it gains industry traction, I don't see any compelling reason to pay the early-adopter price and use it.

    --
    For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
    1. Re:It's the libraries, stupid by ChrisNSauls · · Score: 1

      You don't have to re-write all your old C code, as D is link-compatible with C. And adding these features to C/C++ has been tried... that's how D got started in the first place! (See the DMC compiler for what I'm talking about.)

    2. Re:It's the libraries, stupid by shenanigans · · Score: 1

      Why would you want to justify rewriting all your C++ code into D? That's like converting all your MP3s to OGG because it's new and shiny. Nobody is forcing (or even asking) you to use D, if it doesn't fit your needs just don't use it.

      For my part I've been using the language almost exclusively for about two years now, but most of my projects have been new projects. What little I had of personal "helper" libraries in C++ were either easy to convert or unnecessary in D.

    3. Re:It's the libraries, stupid by Anonymous Coward · · Score: 0

      On unit testing.

      I know many companies don't use unit testing. Why?

      As and good coder knows the best coders are lazy. They don't have time to be rolling there own unit testing. Finding, evualuating and hooking in every library on the planet does not come for free. Also the more libraries you link in lead to code bloat. You'd know that if you've ever worked on a large project. Compile times are a killer.

      D's approach is to provide the user with the most common used constructs inside the lanaguage, in a neater form then most languages provide though libraries.

      The simpiler something is the more likly it'll be used. Unit is one such case which is best encouraged.

  41. Re:Erm how is this better.. by ZenShadow · · Score: 1
    Wow. That is so full of misinformation that I can't believe you even bothered to post it.

    And for the record:

    $ wget -S -O/dev/null http://www.myspace.com/
    --15:13:53-- http://www.myspace.com/
                          => `/dev/null'
    Resolving www.myspace.com... 216.178.32.51, 216.178.32.52, 216.178.32.137, ...
    Connecting to www.myspace.com[216.178.32.51]:80... connected.
    HTTP request sent, awaiting response...
      1 HTTP/1.1 200 OK
      2 Connection: keep-alive
      3 Date: Mon, 01 Jan 2007 23:13:53 GMT
      4 Server: Microsoft-IIS/6.0
      5 X-Powered-By: ASP.NET
      [ ... ]


    I see no Java here.

    --S
    --
    -- sigs cause cancer.
  42. This won't work...Sex. by Anonymous Coward · · Score: 0

    "If it doesn't interest you, don't use it."

    Good thing Geeks aren't applying your advice to procreation, else we'd die off.

  43. Re:Erm how is this better.. by SnprBoB86 · · Score: 1

    The .net Compact Framework also runs on the Xbox 360 (PowerPC) and plenty of other devices (ARM, etc).

    --
    http://brandonbloom.name
  44. Re:Erm how is this better.. by TheRaven64 · · Score: 1
    I don't know .NET well enough to comment, but I can think of a couple of advantages of the JVM:
    1. Load-time safety checking. Java bytecode is a lot easier to reason about that x86 machine code. This means that the loader can relatively cheaply check that loaded code conforms to the security model.
    2. Optimisation. It is possible for the JVM to inline function (well, methods) at run-time that are commonly called. If you have a loop in a C program that calls printf (For example), you can't ever inline it, because you need to dynamically link against libc (well, you don't have to, but a modern libc is several MBs, and you would get some very bloated apps if they all included libc). The JVM, however, could inline the equivalent when it did the JIT compilation to native code.
    Of course, Java is let down a lot performance-wise by having some very bad abstractions. My favourite example is arrays; a low-level concept shoe-horned into a high-level language. Lists, tuples and sets are much better abstractions, both from the point of view of generating fast and safe code and from the point of view of a developer.
    --
    I am TheRaven on Soylent News
  45. I don't get it... by autophile · · Score: 1

    Okay, it's a new C-like and Java-like language. But WTF is this:

    Simple Operations should be Simple

    A common and simple operation, like writing an array of bytes to a file, should be simple to code. I haven't seen a class library yet that simply and efficiently implemented common, basic file I/O operations.

    What, writing an array of bytes to a file is difficult in Java?

    I'm not sure about the whole hoo-hah about "is-expressions"/conditional compilation. Personally, I've always hated the infinitely regressive #ifdefs in C. Operator overloading -- you can keep it. Causes more trouble than goto.

    In the end, what I'm looking for in a language is increased productivity, increased ability to architect changes, and increased understandability. I want to be able to pick up a printout of program X in this hypothetical language, understand what it does without a manual, help from the original developer, or reverse-engineering sessions (the code is the description is the code, and not in the RTFS sense), and be able to add stuff or modify it easily, and recompile without having to set up crazy environments.

    I wish language researchers would pick up today's programs, and try to figure out what they could do to make things easier.

    Yeah, I know, I'm probably dreaming.

    --Rob

    --
    Towards the Singularity.
    1. Re:I don't get it... by ChrisNSauls · · Score: 1
      We (the D programmers) don't like #ifdef either... which is precisely why we have in-language alternatives for the cases where #ifdef and company were (at least potentially) useful. For example, say you have a function Bob. Bob is a very useful character... but he relies on some function in the local Operating System's API. Let's say on Windows Bob needs to use Wally, and on Linux he needs to use Larry. Okay... no problem.

      void Bob (int a, int b) {
      version(Windows) {
      Wally(a, b);
      }
      else version(Linux) {
      Larry(b, a);
      }
      else {
      static assert(false, "Unsupported Operating System.");
      }
      }
      As for is-expressions... suppose you have a template called... uhm, Ted. And Ted is, also, quite useful... but if Ted's parameter happens to be, say, a float, you want it to do something a little different. But! You don't want to have to write a second full version of Ted just to change that one little thing! No problem.

      template Ted (T) {
      static if (is(T == float)) {
      // do stuff the floating way!
      }
      else {
      // do stuff the usual way.
      }
      }
    2. Re:I don't get it... by Jeppe+Salvesen · · Score: 1

      Wunderbar.

      (Except that we of course want to see that Wally/Larry sucessfully completed)

      But how sophisticated is that 'version' call? Not everything is the same on different versions of the same operating system..

      --

      Stop the brainwash

    3. Re:I don't get it... by VGPowerlord · · Score: 1

      It does seem odd that someone would say it'd hard to write a stream of bytes to a file in Java, considering that you just need to do the following:

      private final String OUTPUT_FILE = "output.bin";
      protected byte[] byteArray;

      // Other code to create and fill byte array here

      private FileOutputStream out = new FileOutputStream(OUTPUT_FILE);
      out.write(byteArray);
      out.finalize();


      Done.

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
  46. Re:The feature-checklist school of software design by cowboycarl · · Score: 1

    I agree, particularly with your recommendations for "small and clean languages" and "the right tool for each job". IMHO, the world has more than enough 3rd Generation Languages already, and 4th too... It's time to move forwards not sideways.

    Tools that help me are not new languages... an IDE, perhaps like Eclipse (and all it's plugins) that helps to manage complexity by supporting projects that span multiple programming languages, provide revision control, continuous integration etc. So much of my work involves maintenance, I would like to see a tool that can make a million lines of code easier for me to understand, perhaps the source code navigation history of previous developers. But why work on something hard like that when you can do something easier and more fun like a new front-end to a compiler?

  47. Re:Erm how is this better.. by bigorilla · · Score: 1

    The benefit of a VM over compiling to native is that it enables cross-platform closed source.

  48. just use Code::Blocks ide by Anonymous Coward · · Score: 0

    it has some IDE support, like Code::Blocks SVN
    http://codeblocks.org/

    1. Re:just use Code::Blocks ide by trimbo · · Score: 1

      it has some IDE support, like Code::Blocks SVN

      The only IDE support is in an SVN repository for a tool that last saw a packaged release in 2005?

      Guys, this just doesn't sound realistic. These are the things that need to be overcome for exotic languages to get widespread acceptance in the corporate world. It's one thing to adopt a language like D when you're working on something at college or in your basement. It's a totally different situation when you're writing code that need to be extended, supported and linked to by hundreds of people.

    2. Re:just use Code::Blocks ide by Anonymous Coward · · Score: 0

      um, you don't have to build it from source, you can use a nightly build, which they reccomend you to use anyways.

      and the IDE itself is phenominal

  49. Keeping It Simple by rumblin'rabbit · · Score: 2, Insightful
    Amen. Here's a quote from the article:

    Special attention is given to the needs of quality assurance, documentation, management, portability and reliability.
    So where is the word simplicity in all of this? Anybody that has learned to use C++ really well has, to my mind, earned the equivalent of a Master's degree. This makes C++ a brilliant failure. So to learn D will we require the equivalent of a PhD?


    Good designers make things both simpler and more powerful. They improve the product as much through subtraction as addition. Instead we get this...

    and Walter has continued to add more and more features.
    Bloody hell.
    1. Re:Keeping It Simple by DropArk · · Score: 2, Interesting

      So where is the word simplicity in all of this? Anybody that has learned to use C++ really well has, to my mind, earned the equivalent of a Master's degree. This makes C++ a brilliant failure. So to learn D will we require the equivalent of a PhD? No. Definitely not. Compared to C++, Java, and C#, the D programming language syntax is clean and simple. Sure there are exceptions (the 'static' keyword is way too overloaded) but there aren't many of them. I'm guessing you haven't actually tried to use D on any non-simple problem yet. But if you have and still claim it lacks simplicity, I'd be very interested in knowing your exact and specific findings.

      Good designers make things both simpler and more powerful. They improve the product as much through subtraction as addition. Instead we get this...

      and Walter has continued to add more and more features.
      Bloody hell. I'm sure you know that many things that are simple to use are also complex under-the-hood. In order to make D simple to use, some very complex concepts have been implemented. Also, reducing syntax is not the same as increasing the simple-to-use factor. If you take a look at the Forth programming language, its syntax and keyword usage is extremely simple. And yet it is often called a write-only language.
    2. Re:Keeping It Simple by rumblin'rabbit · · Score: 1
      I'm guessing you haven't actually tried to use D on any non-simple problem yet.
      Actually, I don't know anything about D except from articles like the above. Thanks for your assessment - it is reassuring.


      If D is cleaner and simpler than C++ then they should advertise that aggressively. I would consider it a critical point.

  50. Shouldn't it be called 'P'? by aegl · · Score: 2, Informative

    BCPL was one of the sources of inspiration for the programming language 'B', and its successor 'C'. Next in the series ought to be 'P'.

  51. Aren't C# structs stack-based classes? by Anonymous Coward · · Score: 0

    C# fails 2 and 3. Actually, although I'm no C# programmer, I'm pretty sure C# lets you create stack-based classes. Unless you don't consider C#'s structs to be true stack-based classes, in which case I'd be curious to know why you feel that way.
  52. EVERY Language Sucks by JoeCommodore · · Score: 2, Funny

    I mean, like, I try to write this program, and like, the language does ONLY what I tell it to, not what I really want. That really sucks.

    Can't someone write up some stuff that understands proper english? Geez.

    --
    "Enjoy what you're doing! If it becomes drudgery, you're doing it wrong!" - Jim Butterfield
    1. Re:EVERY Language Sucks by istartedi · · Score: 2, Funny

      %ecc posting.english -o test
      warning 1: ``like" is superfluous teen speak, construct discarded.
      warning 1: ``and like" is superfluous teen speak, construct discarded.
      warning 3: ``english" assumed to be ``English".
      warning 3: ``Geez" undefined. Linking against null action function.
      % ./test
      The poster's meaning is that he tries to write a program.
      We have established that ``That" really sucks, and we are
      assuming that ``That" is the poster's act of writing a program.
      Can't someone write up some stuff that understands proper english (Y/N):
      --
      For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
    2. Re:EVERY Language Sucks by openldev · · Score: 1

      Like, that would be great, like, if they did that. But, like, you know people can't write, like, good english. Hehe. But in all seriousness, how many programmers do you know that use correct grammer? A compiler for a language such as that would just be terribly difficult. (Yes, I know that you are probably meaning this post as a joke, but I have had interest in this type of language for some time. I believe they were trying to do something like this at MIT, but it didn't seem too promising.)

    3. Re:EVERY Language Sucks by Anonymous Coward · · Score: 0

      Geez I mean, like, are you sure, like, you want, like, a compiler that understands proper English?

      Cos it seems, like, to me, like, that you'd be like *waay* more productive if you stuck with Valgol.

    4. Re:EVERY Language Sucks by JoeCommodore · · Score: 1

      Well, Um, I tried Valgol, and my code kept gagging with like "Spoon Error"s. :-P

      Dude.

      --
      "Enjoy what you're doing! If it becomes drudgery, you're doing it wrong!" - Jim Butterfield
    5. Re:EVERY Language Sucks by rbarreira · · Score: 1

      You have to wait until powerful AI comes along :)

      --

      The AACS key is NOT 0xF606EEFD628B1CA427BEA93A9CA9773F
    6. Re:EVERY Language Sucks by Anonymous+Brave+Guy · · Score: 1

      Ah yes, a computer that understands English. What a wonderful idea...

      Picard Abort auto-destruct sequence.

      Computer Riker, William T., do you concur?

      Riker Yes, absolutely. I do indeed concur wholeheartedly.

      Computer Auto-destruct cancelled.

      [Huge sigh of relief from all]

      Picard A simple "yes" would have sufficed, Number One.

      Riker I didn't want there to be any chance of misunderstanding.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    7. Re:EVERY Language Sucks by Geeselegs · · Score: 1

      The problem with natural language programming is logic jumps, when you describe something in english 95% of the time you describe the end result and not how to produce it. Programming languages force you to describe what you want in a way that could be reproduced exactly.

  53. Re:Another 'Toy' Programming Language by Rufty · · Score: 1

    Intel Hex. Anything less is for quiche-eaters.

    --
    Red to red, black to black. Switch it on, but stand well back.
  54. should be possible to write os in python by vyvepe · · Score: 2, Informative
    How many OS'es are written in Python? Neither Java, ruby, perl nor python attempt be appropriate languages for writing OS'es. This doesn't make them good or bad. Other factors might.

    It might be possible to write OS in those loanguages. MS is trying to do it in C#. The project name is Singularity. But I agree that OS in not the target domain :)

  55. object oriented by elmartinos · · Score: 2, Insightful
    From TFA:
    // Object Oriented Programming
    CmdLin cl = new CmdLin(argc, argv);

    Why do they always insist on this bad syntax? Why can't they write
    CmdLin cl = CmdLin.new(argc, argv);
    This way you can think of CmdLin as an object, new is just a method that returns a new instance. Voila, one keyword removed, and much cleaner syntax. This would not even offend the Java people because they can have the same syntax with a static method.

    1. Re:object oriented by iluvcapra · · Score: 1
      This way you can think of CmdLin as an object, new is just a method that returns a new instance. Voila, one keyword removed, and much cleaner syntax. This would not even offend the Java people because they can have the same syntax with a static method.

      D doesn't appear to have meta-classes, so classes are not objects, so an operator may be a better choice for instantiating than a static method; D also appeas not to have dynamic class loading, either. If you're all about the Class.new or [Class new] way of life, you may have to stick with Ruby or Objective-C or Smalltalk.

      --
      Don't blame me, I voted for Baltar.
    2. Re:object oriented by Anonymous+Brave+Guy · · Score: 1

      Or even this:

      CommandLine cl(argc, argv);

      With the characters saved by removing redundancy, I've even managed to give the type a meaningful name, instead of using the "abbreviations just obscure enough that everyone has to look up exactly how to spell them every time" technique. :-)

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    3. Re:object oriented by DropArk · · Score: 1
      If its the syntax you have issues with, it is possible to use this syntax in D ...

      CmdLin cl = CmdLin(argc, argv);
      in which it will call the static class method called 'opCall', used as a factory method. And if this is too much redundancy, one can also say ...

      auto cl = CmdLin(argc, argv);
      where the 'auto' causes the compiler's type inference to kick in.
    4. Re:object oriented by newt0311 · · Score: 1

      how about just CmdLin cl = CmdLin(argc, argv);

    5. Re:object oriented by Halo1 · · Score: 1

      Or Object Pascal :)

      --
      Donate free food here
    6. Re:object oriented by VGPowerlord · · Score: 1

      It might have something to do with the new keyword, in most languages, creating things on the heap rather than the stack.

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
  56. I just have to say... by Myria · · Score: 1

    C# is D flat.

    From my friend harmony7.

    --
    "Screw Sun, cross-platform will never work. Let's move on and steal the Java language." - Visual J++ Product Manager
    1. Re:I just have to say... by TeknoHog · · Score: 1

      C# is D flat.

      Only in a 12-tone equally tempered scale.

      --
      Escher was the first MC and Giger invented the HR department.
    2. Re:I just have to say... by Anonymous Coward · · Score: 0

      Only in the most common tuning system.

  57. Is this a funny troll? by Anonymous Coward · · Score: 0
    I am hoping that D is or soon will be a good alternative to C#.net and Mono.


    Is this a funny troll?


    D has always been a better (higher performance; less legal risk; easier to develop; more stable; more complete) alternative than Mono.


    And on non-windows platform's it's always been a better alternative to C#.net.


    IMHO, though Ruby + C extensions is the most productive environment.

    1. Re:Is this a funny troll? by Anonymous Coward · · Score: 0

      also wxD for wxWidgets.

      http://wxd.sourceforge.net/

    2. Re:Is this a funny troll? by twkrimm · · Score: 1

      No I am not a Troll. I have 20+ years programming experience and I do not want to go back to the old OS/2 and Windows 9x GUI design days. I want a Rapid GUI Development Environment similar to Borland C++ Builder or Visual Studio C#.net. I want to draw the widgets on the screen, click the widget and poof you are editing the widget_click function. Quick, simple, do not have to worry the details unless you are doing something special.

    3. Re:Is this a funny troll? by Anonymous Coward · · Score: 0

      Although I like D. This is my biggest dislike. It's not C# like in the way of .net although the lanaguage is still nicer. Someone was working on a D#, although lost his work due to a harddrive failure. Well I guess no-one is perfect :(

      I hope he tries again, but this time with a team.

  58. You should try more than one language. by Generic+Player · · Score: 1

    Duck typing is a retarded name for something that does not exist. Its just plain old strong dynamic typing. And that does not lead to productivity gains. It just leads to runtime type errors and long term maintainance headaches. This ridiculous notion seems to be because people compare static typing as implimented in java to dynamic typing as implimented in ruby or python. Try haskell or ML before blindly repeating nonsense.

    Most of the productivity gains of high level languages come from having advanced data types available, and extensive libraries to do things you have to do by hand in lower level languages. It has nothing to do with static vs dynamic typing, or smalltalk style dynamicism vs compile time metaprogramming. Either can be used in a productive language, just because ruby uses dynamic smalltalk inspired design and is a productive language, doesn't mean only dynamic smalltalk inspired languages can be productive. You'll notice that smalltalk obviously has the same smalltalk dynamicism ruby does, yet ruby is more productive. Why? Because ruby provides more high level abstractions to save you time.

    1. Re:You should try more than one language. by albert+bulawa · · Score: 1

      Duck typing is a retarded name for something that does not exist. Its just plain old strong dynamic typing. But it does exist, unfortunately, Bad thing as it is. It does only check if a method for a given signature exists while real strong typing, dynamic or not would also check if that method is inherited from the correct superclass or implemented from the correct interface.

      Try this somewhat overdramatic example:
      public interface ZipFile { public void explode(); }
      public interface NuclearBomb { public void explode(); }

      Duck typing will accept an instance implementing NuclearBomb to call ZipFile's explode() while strong typing will not.

      BTW, the Visual Editor folks have implemented static duck typing for Java, so it does not even have to be dynamic.
    2. Re:You should try more than one language. by Generic+Player · · Score: 0, Flamebait

      "But it does exist, unfortunately"

      No, just because pompous dimwits (why are they always ruby users) make up new (stupid) names for old things, doesn't mean we have to play along and give them the attention they crave.

      "It does only check if a method for a given signature exists while real strong typing, dynamic or not would also check if that method is inherited from the correct superclass or implemented from the correct interface."

      You are confused about what strong typing means. You are talking about structural typing vs nominative typing, which is completely orthogonal to dynamic vs static and strong vs weak.

      Both ruby and ocaml are strongly typed languages. You can't coerce one type to another, defeating the type system. Ocaml is static, it checks types at compile time, and thus forbids you from assigning a different type to the same variable. Ruby is dynamic, checking types at run time, so you are allowed to make x be a string here, and then a float there.

      They are both structurally typed, meaning object types are considered equivilent if they have the same signature. Nominally typed languages require explicit inheritance to be considered equivilent. Just because java is static, strong and nominative, doesn't mean you have to be nominative to be strong. Or that being nominative makes you strong. You can have strong and structural, or weak and nominative.

  59. STL by Anonymous Coward · · Score: 0

    Picture this scene... Darth MasterProgrammer standing over Luke RookieProgrammer... [If only you knew the power of the STL!!!]

    I see this time and time again. Programmers bad mouthing C++ because they don't understand the power of the language and really don't understand the STL.

    As for compilers being slow, it really shouldn't matter that much unless you truly are a rookie and need to compile after every line of code and run a test just to make sure it compiles much less runs. I would much rather have a compiler that's been working in the field for years on all types of projects not just sample, simple test case projects.

  60. The primary reason for stack class allocation... by tlambert · · Score: 1, Informative

    The primary reason for stack class allocation is that you may need to do your instancing at interrupt time or in a trap handler.

    Consider the case where you have a memory shortage (but interrupt stacks are preallocated, per interrupt), and therefore you cannot do an allocation, but want to run the current operation to completion.

    Consider also the case where you might be using a zone allocator, and you cannot expand the zone of zones, because in order to do so, you' need to handle a trap at ring 0 in a trap handler (i.e. a user page fault followed by a kernel page fault).

    The reason that these things wuld not be allocable at interrupt/trap time is that the allocations may block, and, if they do so, you could effectively end up blocked with interrupts disabled and no way to get back from it.

    The alterantive to this is that you would have to fail the request and back out your state all the way back (fail gracefully out). The problem with that approach is that now you have to put error checking around all of your function call graph hat could eventually result in potentially failing allocations, and deal with the performance degradation that might result (speculative execution on a PPC would make this effectively free, but on an x86, you would pay a fairly seiors penalty).

    There are three approaches commonly used in handling memory stavation situations:

    (1) Block until the memory is available

    (2) Fail the allocation request, and be prepared to deal with the failure, and then hope that by backing off, you don't lose unrecoverable state (e.g. if I read a hardware register, that might signal something to the hardware that would preclude me restarting the operation - for example, the AMD Lance Ethernet hardware), and that it's possible to redrive the operation

    (3) Djikstra's Banker's Algorithm: allocate all resources that you might need up front, before attempting the operation (this is typically what's done with, e.g. the ring buffers associate with ethernet devices, rather than allocating mbufs at interrupt level).

    The instancing of classes on the stack falls under a variant of #3: because you already have the stack preallocated, you are guaranteed that, so long as you do not exceed your stack depth, instancing the objects you need to instance for the lifetime of the transaction you are about to perform will always be successful.

    I'm not sure if that's the argument the poster to whom you were replying was referring, but I hope that clarifies things for you.

    -- Terry

  61. What are you talking about? by Anonymous Coward · · Score: 0

    A VM doesn't give any advantages, and no VM languages are as fast as C/C++/D. C# is 2x to 10x slower depending on the task. And being forced into a VM removes a languages ability to be used for systems programming, which if you bothered to read is what D is for.

  62. Re:Erm how is this better.. by Generic+Player · · Score: 1

    Neither runtime safety checks nor a logical standard library have anything to do with a VM though. A native compiler can insert safety checks just fine when producing machine code.

  63. Re:The feature-checklist school of software design by eluusive · · Score: 1

    Have any of you actually used the language yet? It's not a hack. By merging all these useful features to begin with a very useable result was attained. In the time you spent with that post you could have actually read the language specification.

  64. Alternative Intro Site for Info - Wiki by Embedded+Geek · · Score: 1
    If you're having some response problems from http://www.digitalmars.com/d/ as it skirts the edge of slashdotting, I found a wiki via dsource.org:

    Enjoy!

    --

    "Prepare for the worst - hope for the best."

  65. Re:Another 'Toy' Programming Language by mccoma · · Score: 1

    real software engineers (that is, engineers who can legally call themselves engineers)

    Where exactly is this possible?

  66. Re:Erm how is this better.. by thammoud · · Score: 1

    By going to the site, you can clear see that they are using cold fusion (cfm extension). Cold fusion is based on Java. They seem to be using IIS for some presentation (main page) but the heart of the system is clearly Java based if you read the links. GP was correct.

  67. Re:Erm how is this better.. by thephotoman · · Score: 1

    Well. They're running IIS at MySpace. Somebody, please, for the love of good web design and stopping pedophiles, bring that thing down.

    --
    Haec merda tauri est. Ceterum censeo Carthaginem esse delendam.
  68. I have a problem with GC in a systems language... by tlambert · · Score: 1

    I have a problem with GC in a systems language... specifically, using GC means that your functions will not necessarily run in bounded time.

    For a lot of uses, particularly in user space, this is not a problem, but if you were to kick of GC in an interrupt handler or trap handler, or a number of other places, this would make it impossible for you to implement code that was guaranteed to take at most a maximum number of CPU cycles.

    The upshot of this is that so long as it's possible for someone to write a driver that ends up running in your kernel, and which depends on GC functionality to not leak memory, it will be impossible for an OS written in that language to support hard real time.

    I have to say that GC is marginally useful for systems work only if you can run it on a system that doesn't need GC -- so that you can get a read out of where and how you are leaking memory, fix the problem, and then disable GC before you ship. In other words, it's a great diagnostic, but only if you can run both GC and non-GC at the same time, and only if you explicitly scope your allocations (i.e. act like you are not running in a GC'e lanuage in the first place).

    In other words, the intent of GC is to make programmers not have to know where their scope boundaries are, and you _must_ know this for systems programming tasks. So it doesn't deliver on its promise in a systems context, though it could be a helpful diagnostic for developers.

    -- Terry

  69. Comparison to Objective-C? by Jimithing+DMB · · Score: 4, Interesting

    I noticed that a comparison to Objective-C is quite conspicuously absent from the list of languages compared to D. Why is it missing? Granted D seems to be a much greater change to C than Objective-C is but I can't help but thinking that one of the main attractions to D seems to be its heap-based garbage-collected object system. You can already get the object runtime with Objective-C. If you use GNU you can even have Boehm GC (which is apparently the GC that D uses). If you use Apple you will have to wait for Leopard to get GC. Another new Objective-C feature is the ability to use full C++ objects as instance variables in your Objective-C classes and do the right thing with initializing (calling the default no-argument constructor upon alloc).

    On top of that, Objective-C actually includes tons of reflection information. Although Objective-C has protocols which are roughly equivalent to Java/C# interfaces they are almost completely unnecessary. In Objective-C one can query at runtime whether a method is implemented or not and if so call it. So whereas in Java you'd do this:

    if(anObject instanceof MyInterface) ((MyInterface)anObject)->doSomething();

    in Objective-C you can do this:

    if([anObject respondsToSelector:@selector(doSomething)]) [anObject doSomething];

    The difference being that in the Java case you have to declare MyInterface as containing the one doSomething() method and inform java that your object extends MyInterface whereas in Objective-C you merely need to provide a doSomething method on your object.

    Basically that means that in Objective-C every single method effectively becomes an interface. You would not believe how useful this is once you realize it. Note that at runtime there is ZERO difference. In both the Java and Objective-C cases the object is being checked to see if it implements something. Same with C++ if you use dynamic_cast<>()

    Granted every language has its niche and I'm sure D will find its. Objective-C's niche is definitely GUI programming. The ample reflection information allows for easy implementations of archiving (serialization) and most importantly key-value coding and the related action methods pattern. It's a pretty damn cool thing when your RAD tool simply outputs archived objects that refer to methods to be called upon certain actions simply by name.

    1. Re:Comparison to Objective-C? by Raenex · · Score: 1
      If you use Apple you will have to wait for Leopard to get GC.

      Umm, if I'm using a language that claims to be garbage collected then it damn well better work everywhere the language is implemented. This alone is enough reason for a language like D to exist.

    2. Re:Comparison to Objective-C? by xenocide2 · · Score: 1

      Boehm GC is crap. Sometimes, its the best crap you can use, but that doesn't make it not crap. The basic idea is they scan the stack for potential indexes into the heap, and anything that could be a pointer to somewhere in the heap (as opposed to say, a dollar amount that happens to be expressed in signed ints or something) is considered a reference and the indexed object is kept. In this sense, Boehm is called a "conservative" collector. As far as automatic garbage collection without language support goes, it's tops. But it doesn't hold a candle to decent language analysis.

      Fortunately, D does not use Boehm by default. Judging by the tips it has for pointers, it uses a copying garbage collector. The benefit is that it doesn't suffer memory leaks, but it does do a number on caching. There's other problems, some of which seem to be specific to D's desire to be compatible with C.

      --
      I Browse at +4 Flamebait

      Open Source Sysadmin

    3. Re:Comparison to Objective-C? by Anonymous Coward · · Score: 0

      > So whereas in Java you'd do this:
      > if(anObject instanceof MyInterface) ((MyInterface)anObject)->doSomething();
      > in Objective-C you can do this:
      > if([anObject respondsToSelector:@selector(doSomething)]) [anObject doSomething];

      Does that mean that ObjC is just an untyped language? Nothing to be proud about, then. The Java way is so much better because an explicitly declared interface means the implementor knows what to provide.

      If I want to implement anObject for your method, I need first to read its entire body, find all such stanzas and then implement all methods called, having no guarantee that a newer version of this method won't expect another method on my side, whereas in Java I have to find where anObject is only declared (probably a argument, which is retained after the compilation as well, so I don't have to even look at your source) and implement all methods on this interface. OTOH you, when you want to extend this interface, you will know that you'll break everyone using it, so you'll probably provide MyInterface2 (extending MyInterface) instead.

      That means software is more maintainable, more stable, thus better.

      Is really ObjC that retarded?

    4. Re:Comparison to Objective-C? by abell · · Score: 1
      Does that mean that ObjC is just an untyped language?

      It is typed, in that each object has a type, but methods can accept or return objects without restrictions on their type (imagine using Object more in Java and not needing explicit casts). On the other hand, you still have the choice to specify types explicitly, if you are more on the apprehensive side.

      If I want to implement anObject for your method, I need first to read its entire body, find all such stanzas and then implement all methods called

      You don't just go around implementing objects for methods only caring about type compatibility. You are usually supposed to know that applying a certain method to a certain object makes sense in your program's architecture, types or lack thereof notwithstanding.

      That means software is more maintainable, more stable, thus better.

      But if the software is also more verbose, less extensible and has a bigger footprint, does that mean it is also worse? May it be that language goodness is not a monodimensional quality and that different languages have different strong and weak points?

      Cheers
    5. Re:Comparison to Objective-C? by ChrisNSauls · · Score: 1
      Actually in D you can check for the existance of a method by name at compile-time. I admit I haven't used this particular feature myself as yet, so I may not be remembering just exactly how to do it, but it should be at least close.

      static if (is(typeof(anObject.doSomething))) { anObject.doSomething; }
      Using traits template meta-functions one can check that 'doSomething' has a certain return type, that it takes parameters of a certain number and with certain types, etc. Should you actually need that much. As for the interfaces technique above, this is also available in D if you need to guarantee a sleugh of properties. With both a compile time means:

      static if (is(typeof(anObject) : MyInterface)) { anObject.doSomething; }
      And a run time means:

      if (auto faced = cast(MyInterface) anObject) { anObject.doSomething; }
      Because D returns a null for a failed up/down-cast of objects, such an if statement effectively filters on inheritance of classes / implementation of interfaces.
    6. Re:Comparison to Objective-C? by albert+bulawa · · Score: 1
      It is typed, in that each object has a type, but methods can accept or return objects without restrictions on their type (imagine using Object more in Java and not needing explicit casts). On the other hand, you still have the choice to specify types explicitly, if you are more on the apprehensive side.


      Or is it? It's a duck typed language then. Or, simply put, untyped. Of course, data has to have types, even Ruby cannot deny that one. But if the language does not have static type information it must resort to duck typing anyway. And duck typing is just a disaster to the maintainability of anything more than a throwaway script.

      You don't just go around implementing objects for methods only caring about type compatibility. You are usually supposed to know that applying a certain method to a certain object makes sense in your program's architecture, types or lack thereof notwithstanding.


      But I do. Whenever I am implementing a listener for a GUI event I do. Of course it has to do something useful, not just be type compatible but I'm depending on the declared interface I have to implement. I don't look into Swing's or SWT's source to find what methods on the object I provide might or might not be called, I just implement them. If I don't need them all (for example I know the mouse might be moved but no sense to drag it on a widget) I leave some empty, but I still have to provide it. If I was relying on source reading or documentation, I could miss that one (e.g. dragging) because I don't need or want it, but the framework would still try and call it when a user drags the mouse and my application would crash.

      But if the software is also more verbose,


      True, but this kind of verbosity is good because it brings information to the class' clients. Just by looking at a method declaration you know for sure what you need to provide and that you need to provide nothing more. And when someone is irresponsible enough to modify a published interface, you'll know this also as soon as you try to reuild your application against a new version.

      less extensible


      False. In fact it is more extensible with static typing and its advantages than without it, while protected against bad extending - i.e. breaking existing clients.

    7. Re:Comparison to Objective-C? by palad1 · · Score: 1

      Think as instances as message consumers and the [] syntax as a message sent.

      Java:
      quizz.addQuestion("The meaning of life, the universe, and everything"42);

      calls the addquestion(string,int) method on an instance

      obj-c:
      [quizz addQuestion:@"The meaning of life, the universe, and everything", withAnswer:32]

      posts a message for quizz, contents: addQuestion (NSString), withAnswer (int)

      then if quizz exists and it has a handler for the addQuestion, withAnswer message, it gets executed. if not an error is set.

      So obj-C is a strongly-typed languaged using a macro-based message-passing framework.

    8. Re:Comparison to Objective-C? by albert+bulawa · · Score: 1

      No, it is not strong typing, it is duck typing.

      If one next line is quizz.removeQuestion("some question"); or, I suppose [quizz removeQuestion:@"some question"] for ObjC in Java it is impossible that the quizz object does not implement both methods, or the program will not compile. In ObjC OTOH it is possible, the program will compile and run until the removeQuestion message is actually passed to the object which might not happen for months if it's within a conditional branch which rarely gets executed.

      Let's take it a bit further: I take your QUIZZ library, read up a bit then implement my own quiz type with addQuestion but without removeQuestion (because at first I don't need it and then I simply forget) and then give it to someone. They are happy and add more and more questions, but the time comes they want to remove one. They click remove and KABOOM goes their system. Why oh why? Because Quiz object should implement removeQuestion but it does not. Let's take the Java version now: I implement Quizz interface - I don't need removeQuestion now, but I *have* to implement it, so I just throw UnsupportedOperationException from that method. I forget about it - it is implemented after all, isn't it? So when the user wants to remove a question they see what exception was thrown and by which code, so they call me and shout why it is not implemented? :) No KABOOM, an obvious log entry.

    9. Re:Comparison to Objective-C? by Perky_Goth · · Score: 1

      First of all, you catch it in testing ;)
      Second, you can always see if the method is there before calling it.
      I don't see it as a big deal, although I only used it a bit with python. (which keeps the usual syntax, object.likelymethod() ). I prefer the benefit of rapid development to verbosity.

    10. Re:Comparison to Objective-C? by albert+bulawa · · Score: 1
      First of all, you catch it in testing ;)

      Well, I hope the ";)" means you're not that serious. It's not about bugs, I don't believe that static typing prevents any more bugs from happening than a decent unit test suite would. In fact I don't believe that static typing along with TDD will let less bugs through than TDD on a dynamic language itself.

      Second, you can always see if the method is there before calling it.
      I don't see it as a big deal, although I only used it a bit with python. (which keeps the usual syntax, object.likelymethod() ). I prefer the benefit of rapid development to verbosity.

      Checking for a method is of no worth. If I get an object I hope to send a message to, and I cannot send then I'm hopeless anyway.

      So called rapid development has some benefits for first time programmer, but it is in fact hostile to program maintenance and, in case of writing a library or framework to all of it's users as well. That's not about checking and throwing, that's about giving information to co-developers or users.
    11. Re:Comparison to Objective-C? by albert+bulawa · · Score: 1

      I implement Quizz interface - I don't need removeQuestion now, but I *have* to implement it, so I just throw UnsupportedOperationException from that method. Another thing to note: I can use a tool to find all methods that throw UnsupportedOperationException throughout my code and see whether they are really unsupported forever or I just forgot to implement something (I setup Eclipse so default method stubs throw that exception, not return silently some absurd value as Eclipse wants by default). I cannot use a tool to find all objects that miss a method that does not come from a declared interface or can I? Can anyone show me such a tool? And please note that it should have some kind of precognition as well - Java interfaces declared by a framework can have methods that are to be used later while actual framework code is not ready to call them.
    12. Re:Comparison to Objective-C? by albert+bulawa · · Score: 1

      Because D returns a null for a failed up/down-cast of objects, such an if statement effectively filters on inheritance of classes / implementation of interfaces. But it is atrocious! Such a thing should throw an exception, returning null is just so damned atrocious like those C functions returning -1 on failure. We suffered much of them and we suffer still and there are even remnants in Java (such as File.delete).
    13. Re:Comparison to Objective-C? by ChrisNSauls · · Score: 1
      I would hate to think I have to deal with exception handling scaffolds every time I want to check whether an object implementing interface IA also implements interface IB, or IC. I'd much rather just write:

      IA a = ... ;
      //...
      if (auto b = cast(IB) a) {
      //...
      }
      //...
      Than have to write:

      IA a = ... ;
      //...
      try {
      auto b = cast(IB) a;
      //...
      }
      catch (Exception ex) {
      // do nothing, don't care
      }
      //...
      And seeing as how trying to use any members of a null is going to throw stuff anyway... I don't see any problem with it. In fact, I've made quite free use of it in my D code. To each their own, I suppose.
    14. Re:Comparison to Objective-C? by spoier · · Score: 1

      Well that's a silly example. You should have subclassed the quiz type, then it would inherit the removeQuestion interface. I don't see how that's any better or worse than a strongly typed OO language.

    15. Re:Comparison to Objective-C? by albert+bulawa · · Score: 1

      But how do I subclass an interface? I do not.

      And if ObjectiveC version has a default abstract (or Smalltalk way throwing something akin to SubclassResponsibility) class for quiz than it is interface, isn't it? Well, poor man's interface.

      But subclassing a real quiz implementation is even more dangerous than letting duck typing crash the system. If I implement (and thus override) addQuestion() then removeQuestion() should be overriden too or it will be executed completely incompatible with what addQuestion() does. What will it remove? Nothing? Something? Will it throw? No way to know, but it may accidentally remove something from another quiz!

    16. Re:Comparison to Objective-C? by albert+bulawa · · Score: 1
      You should have an explicit type checking operator such as Java's instanceof. But you have another kind of problem here - if you "make a free use" in your code, whether instanceof or this antipattern then you have something wrong with your program design. Well designed program should not have to use this check except in some very special situations.

      And seeing as how trying to use any members of a null is going to throw stuff anyway... I don't see any problem with it. You should see a problem because that null may go unnoticed through many calls and make an exception thrown miles away from where the real error is. Nothing more hostile to maintenance and debugging - countless hours have been spent on such nulls or -1s by programmers where an exception thrown from where the bug really was would require no time to find the bug and you could start fixing it right away.

      That's a more general principle of programming - one of the (if not just *the*) most important, to *fail fast*. Crash your application or class or function as soon as you know you can't make good. I've seen too much atrocious code and hours wasted on debugging where instead of failing the author wanted their code to "survive" no matter what happens, so when they could not use a real value anymore, they resorted to a made up one - null, false and -1 among the favorites.
    17. Re:Comparison to Objective-C? by ChrisNSauls · · Score: 1
      Certainly, but its no problem to utilize contracts for that purpose. (Which i also do quite a bit.) Also, note that in the example I gave, if it failed, then it just skipped over the bit that relied on that implementation. And actually it is not neccessarily a sign of a design problem. There are perfectly good use cases -- for an example, in my Bovis project a given database object may, or may not, be a peer to a user connection. User objects are just exactly like any other object, except that expose a few additional things. For an example, User objects can "own" another object, where no other ones can. So an attempt to set the owner looks roughly like:

      BObject obj = ... ;
      if (auto user = cast(BUserObject) obj) {
      // set ownership details
      }
      else {
      throw new BovisException(" ... ");
      }
      So here we are. Did I end up throwing an exception in this case anyway? Sure did -- but I got to control what exception was thrown, making it easier to target this one. (I want to catch my own exceptions, and expected runtime exceptions, but everything else I want to slip through and crash.) If I really, really just wanted the cast succeed and cared for nothing else, that's what the assert contract is for.

      auto foo = cast(Something) bar;
      assert(foo, "our bar is not a Something!?");
    18. Re:Comparison to Objective-C? by albert+bulawa · · Score: 1

      BObject obj = ... ;
      if (auto user = cast(BUserObject) obj) {
      // set ownership details
      }
      else {
      throw new BovisException(" ... ");
      }
      I see one thing here. This

      BObject obj = ...
      is certainly followed by an expression you strongly expect to return a BUserObject in fact, probably a call to some DAO code, but still your own. Then I see a serious design flaw here, because that expression itself should have failed if it couldn't cook up a BUserObject out of your query - and that's where the problem is, not the cast which would always succeed (and you could use assert on that) if the problem was signaled where it happened.

      Of course, I don't see the big picture so you might have a good reason to do that this way but from what you've shown it's a kind of situation I was writing last time. Not only problem is not signaled when it should be, but due to the cast returning a made up value (null) the bug is not discovered still and only your awareness of this cast atrocity protects from something even worse.

      When I write Java code I don't assert or catch on every cast, I write code so that I don't have to. Prior to 1.5 there were problems with collections and such stuff, but thankfully they are no more. My Java code for your example would be just:

      BUserObject user = ...;
      //set ownwership
      and ... would give a valid object or throw, but not give anything invalid.

      Of course I can still assert that the "impossible" doesn't happen if I want to.

      If I really, really just wanted the cast succeed and cared for nothing else, that's what the assert contract is for. But do you really assert or guard your every cast? Then you're one of those heroes that can use C as well, after all you can check for every -1 that may be given to you instead of a valid value.

      The problem is, people don't do that, and other problem is, you often want to deal with the problem not where it happens but much earlier on your call stack (that's what some people argue against Java's checked exceptions - that if you use them, you end up declaring Exception thrown from all and every method, or converting one exception to another just to throw your problem up the program logic to where it will be dealt with). That's why exceptions, checked or not, prevail over explicit checking for some bogus value.
    19. Re:Comparison to Objective-C? by ChrisNSauls · · Score: 1
      They aren't bad points, honestly. But just so you understand why I'm doing what I'm doing, and why I think the null result is a handy thing, here's a little more context. The following function is a member of the Database aggregate. It only differs from project code in that I stripped comments and a few minor operations to highlight the point.

      void destroy (BObject ref) {
      ref.abandonAll;
      foreach (parent; ref.parents) {
      parent.abandon(ref);
      }
      if (ref.owner) {
      ref.owner.relinquish(ref);
      }
      if (auto user = cast(BUserObject) ref) {
      user.relinquishAll;
      }
      forget(ref);
      log.info(sprint("Destroyed Object: #{0} #{1}", ref.name, ref.number));
      delete ref;
      }
      The alternative would be to have two separate functions, one of which calls the other with an (implicit) upcast anyhow. While that wouldn't be, strictly speaking, a bad way to dit, it also adds 1) maintenance cost, 2) self hand holding, as the Database entity knows all about BObject entities anyhow, 3) the ever so slight overhead of an extra function call on the stack.

      But do you really assert or guard your every cast? Then you're one of those heroes that can use C as well, after all you can check for every -1 that may be given to you instead of a valid value. My each and every single cast? No, I admit I don't -- but then I do try to avoid casts if there are significantly better ways to achieve what I want. (On the D forums there was a mantra during discussions of the cast syntax along the lines of, "Casting often is a sign of a bad design.")

      The problem is, people don't do that, and other problem is, you often want to deal with the problem not where it happens but much earlier on your call stack Oh I do agree with that, which is why I use exceptions most of the time. But in this case, I have found in practice that the "cast(Class/Interface) object == null on failure" idiom actually works out well. Personal gnosis, perhaps.
    20. Re:Comparison to Objective-C? by albert+bulawa · · Score: 1

      The alternative would be to have two separate functions That could be better or not, but it depends on the rest of your code - i.e. would you have to check and cast somewhere else then or not. If so, there is no sense doing that, if not, you might consider it. But that's not the point anyway.

      ps. Java's way would be:

      if (obj instanceof BUserObject) {
        ((BUserObject) obj).relinquishAll();
      }
      or

      if (obj instanceof BUserObject) {
        BUserObject user = (BUserObject) obj;
        user.relinquishAll();
      }
      but if I'm pretty sure that obj really is instanceof BUserObject I don't even check that because I am sure and if I am wrong I am guaranteed an exception.

      But do you really assert or guard your every cast? My each and every single cast? No, I admit I don't -- but then I do try to avoid casts But you don't understand, I make no point about casts but about operations which instead of throwing return a bogus value when they fail. I don't know D, don't know if there are other such operations so I write about casts.

      "Casting often is a sign of a bad design." That is true, but often it is a sign of a language's bad design (think Java pre-1.5 collections) and you just have to cast.
    21. Re:Comparison to Objective-C? by ChrisNSauls · · Score: 1
      Note that in your Java examples, you are checking, then casting anyway. The D version does both the check, and subsequent conditional cast, all at one go. Aesthetics, I suppose.

      But you don't understand, I make no point about casts but about operations which instead of throwing return a bogus value when they fail. I don't know D, don't know if there are other such operations so I write about casts. As far as in-the-language operations go... Array bounds checking is enabled for debug builds (on all three array types), and throws an exception. Asserts throw -- although generally one shouldn't catch these except in unit tests where failure was the desired result. Running "out" of memory throws. (Attempting to access members of nulls gives an Access Violation currently. I admit that, in debug builds, a NullReferanceException/Error wouldn't be a bad idea.) So the general rule of thumb seems to be: if you expect failure a notable portion of the time (about half or so is my personal choice, although its difficult to quantify) return a default or "failed" value; otherwise throw an exception, and be sure to document it.

      "Casting often is a sign of a bad design." That is true, but often it is a sign of a language's bad design (think Java pre-1.5 collections) and you just have to cast. I'd rather not, if I can help it. But I do hear you. Luckily true/explicit casting is rarely neccessary in D. Given a D array that needs to become a pointer, there's a ".ptr" property which directly exposes the raw pointer. The usual implicit upcasts of the C/C++/Java/etc world are still there (short -> int, for example). And we do have a fairly nice templates system in place, one which is by-design suitable for meta-programming, rather than having to be "abused" for such practices as C++ templates often are. (I've seen some interesting things done with this, such as compile-time regexp engines, and a parser generator on a subset of BNF. I'm almost ashamed not to have made more use of it myself.) In short I've not often seen this problem in D, but it might just be a result of personal style.
    22. Re:Comparison to Objective-C? by GWBasic · · Score: 1
      Granted every language has its niche and I'm sure D will find its. Objective-C's niche is definitely GUI programming. The ample reflection information allows for easy implementations of archiving (serialization) and most importantly key-value coding and the related action methods pattern. It's a pretty damn cool thing when your RAD tool simply outputs archived objects that refer to methods to be called upon certain actions simply by name.

      (I'm assuming you're a Cocca programmer.) If you ever get a chance, it's really worth spending a few hours trying out C# or VB.Net. I find the learning curve is much more gentle for GUI prototyping because you don't need to worry about header files, connections, outlets, and misspellings. Also, Visual Studio's intellisense allows you to program with unfamilar APIs in minutes. (Now, if only XCode had intellisense...)

  70. Re:I have a problem with GC in a systems language. by WalterBright · · Score: 2, Informative
    I have a problem with GC in a systems language... specifically, using GC means that your functions will not necessarily run in bounded time.

    malloc (and friends) don't run in bounded time, either.

    For a lot of uses, particularly in user space, this is not a problem, but if you were to kick of GC in an interrupt handler or trap handler, or a number of other places, this would make it impossible for you to implement code that was guaranteed to take at most a maximum number of CPU cycles.

    You cannot use malloc or new in those circumstances either. The correct way to do it is to preallocate all data needed for the interrupt service routine or real time critical section.

    The upshot of this is that so long as it's possible for someone to write a driver that ends up running in your kernel, and which depends on GC functionality to not leak memory, it will be impossible for an OS written in that language to support hard real time.

    Hard real time programming uses preallocated or static allocated data, not malloc or new (or GC).

    I have to say that GC is marginally useful for systems work only if you can run it on a system that doesn't need GC -- so that you can get a read out of where and how you are leaking memory, fix the problem, and then disable GC before you ship. In other words, it's a great diagnostic, but only if you can run both GC and non-GC at the same time, and only if you explicitly scope your allocations (i.e. act like you are not running in a GC'e lanuage in the first place).

    I used to think that, too, until I was forced into working with a GC. I've changed my mind.

    In other words, the intent of GC is to make programmers not have to know where their scope boundaries are, and you _must_ know this for systems programming tasks. So it doesn't deliver on its promise in a systems context, though it could be a helpful diagnostic for developers.

    All I can suggest is try using a GC for a project. My jawboning won't change your mind, but experience might.

  71. Missing the point by pammon · · Score: 4, Insightful
    The largest problem with C++ is its complexity, which causes the language to fragment into partially intersecting sublanguages representing each programmer's comfort zone. D does not address this problem; in fact, it makes it much worse. Example? C++ has seventy some keywords, but D has more than ninety. Another example? See if you can guess what this means in D:


    0XA1_2_C35_4_5_6_5P6_Li

    Give up? Why, it's an imaginary real. Yes, you read that right. Oh, and I specified it in hexadecimal, just to prove I can. And I threw in some underscores because you're allowed to do that too. Have you guessed what an imaginary real is yet? This is supposed to be the "simpler C/C++ replacement."

    A good language strives to find a few constructs that solve multiple problems. A bad language takes the kitchen sink approach. C and C++ are not good languages, but wide deployment and support make them useful anyways. D does not have that, but the designers do have the luxury of learning from the mistakes of the past. So what the hell is their excuse?

    1. Re:Missing the point by donglekey · · Score: 2, Insightful

      A good language strives to find a few constructs that solve multiple problems.

      D does this. You are looking past the dozens of examples where D has cleaned up problems that have been plaguing programmers for years to grasp at a chance to make a piece of code as messy as possible. Maybe you are comfortable working with C/C++ and don't want to deal with another language. I am not comfortable dealing with all the fucked up C and C++ out there. I have worked with D and it is exciting and refreshing. It is much cleaner and you either know it already or need to look harder.

    2. Re:Missing the point by pammon · · Score: 1
      >> A good language strives to find a few constructs that solve multiple problems.

      > D does this.

      It does not. Look at it the author's own language comparison and tell me that D doesn't take the kitchen sink approach. The author does not ascribe to the "small number of flexible constructs" philosophy, and he is obviously proud of that.

      > You are looking past the dozens of examples where D has cleaned up problems that have been plaguing programmers for years to grasp at a chance to make a piece of code as messy as possible. Maybe you are comfortable working with C/C++ and don't want to deal with another language.

      Cleaned up? Not only has D failed to address C++'s complexity, it adds a whole new dimension of pain. Let's consider this piece of code:

      someFunction(x, y++);

      What can we say about it as C, C++, and D code?

      • In C, x and y cannot be modified by someFunction, and y will be increased by 1. We know exactly what values x and y will have afterwards.
      • In C++, x may be modified by someFunction (if it takes a reference type), but y cannot be otherwise modified and will be increased by 1. We at least know what value y will have.
      • In D, x may be modified by someFunction if it takes an inout type, and y may be increased by 1, 2, 3, 4, or more, or by nothing at all, if someFunction takes a lazy type. We no longer know what value either of those variables has.

      See how (needlessly) featureful D is? It is the most confusing and the messiest of the three. This is not a good language.

    3. Re:Missing the point by WWWWolf · · Score: 1
      Have you guessed what an imaginary real is yet?

      Just a wild guess - a complex number with floating points? (a+b*i where a and b are non-integer)

      Well, that just means D has funny type names, and that the said type names hardly unique to D ("God is real, unless declared integer" is a bit older quote than D, I wager). And neither is syntactic sugar that allows people to make numbers unrecognisable a problem per se: a lot of languages allow such syntactic sugar, but fortunately the code reviewers and project style guides generally won't =)

    4. Re:Missing the point by J.R.+Random · · Score: 1

      Have you guessed what an imaginary real is yet?

      Just a wild guess - a complex number with floating points? (a+b*i where a and b are non-integer)

      You guessed wrong. D has both complex reals and imaginary reals, the latter being complex numbers in which the real part is 0. They are distinct types. So far as I can see, this was so that operations like z * 3i could be done with guaranteed two multiplications, rather than four multiplications and two additions as might happen when a dumb compiler sees z * Complex(0, 3). IMHO, it would have been better to have just provided some guarantees that the compiler would be smart enough to detect the obvious cases where you have a pure imaginary number. I consider it to be extremely rude to have a numeric type that is not closed under multiplication.

    5. Re:Missing the point by Anonymous Coward · · Score: 0

      I take your point however I believe you haven't really looked at the language to make an informed decission. Probably went to the website looking for the first thing you could find wrong with it.

      These are all good points if you like scaffolding. It can't be about learning the lanaguage because libraries expand the amount of terms needed to be known 100x. D actually simplifies these libraries. For example no longer are there like 4 array classes to learn to because each lib vendor rolled their own.

      So you must be arguing about compiler implementation. As any coder knows a large size codebase does not aways mean more complex.

      D actually makes the lanaguge eaiser to phase then C++ but so do other newer languages like C# (however C++ is D's niche market). For instance the dreaded highly overloaded shift operator

  72. a good reason by Anonymous Coward · · Score: 0

    algol doesn't support recursion.

  73. OOP languages are slow by bluefoxlucid · · Score: 2, Interesting

    CPUs put a lot of stock in branch prediction; due to the nature of OOP languages like C++, Objective-C (I like this one), and D, this doesn't work. The way virtuals and class inheritence works, functions are necessarily dealt with as pointers; the function is pointed to by pointing to a master class object, basically. Here's a C reconstruction:

    struct myClass_members {
    struct myClass_members *(*alloc)(); // constructor
    void (*destroy)(struct myClass *); // destructor
    int (*my_member)(); // member function
    };

    struct myClass { // Data
    struct myClass_members *call; // Pointer to a list of members as above
    int my_value; // an integer value
    };

    What you do is initialize a constant myClass_members (called myClass_Object here) with a bunch of pointers to static functions in one source file; then call myClass_Object->alloc to create a new one (we'll call it my_inst). Then do my_inst->call->my_member() to call the member, and similarly my_inst->call->destroy(my_inst) to deallocate the class.

    Basically, OOP languages like C++ and Java use this methodology, but it's obscured through friendly syntax. What we can expose from the above is:

    1. When class members change, structs change. This causes binary incompatibility between different versions of libraries. The exception is Objective-C, which looks up members based on their name in a hash table generated at run-time
    2. The addresses of branches (specifically CALL to call a function) are indirect (yes, in Obj-C too); this means that you can replace the class with another class that has the same structure but different functions being pointed at. It also means that the CPU can't do branch prediction, which hurts pipelining and intelligent CPU caching, causing pretty big slow-downs.

    The whole "native execution speed" thing is bunk. Script languages are executed on a native bytecode interpreter, or JIT'd to native. The amount of work that goes into the execution is what you care about; as well as the utilization of the CPU's most powerful facilities. You can only justify OOP languages by saying that either A) the majority of the work doesn't involve making calls to other class members, and thus won't be hurt by this; or B) CPU speed doesn't matter. I hate argument (B); (A) I can accept, barely enough to tip my hat to you for having good software engineering sense.

    1. Re:OOP languages are slow by Tim · · Score: 1

      "CPUs put a lot of stock in branch prediction; due to the nature of OOP languages like C++, Objective-C (I like this one), and D, this doesn't work. The way virtuals and class inheritence works, functions are necessarily dealt with as pointers; the function is pointed to by pointing to a master class object, basically....You can only justify OOP languages by saying that either A) the majority of the work doesn't involve making calls to other class members, and thus won't be hurt by this; or B) CPU speed doesn't matter. I hate argument (B); (A) I can accept, barely enough to tip my hat to you for having good software engineering sense."

      Sorry, but could you repeat that? I can't hear you over the sound of your axe grinding.

      Perhaps you don't know it, but you've (rather wordily) raised one of the classic red-herring arguments against C++: "Virtual Functions Are Slow." Now, sside from the fact that C++ doesn't force you to use virtual methods (which makes me wonder if you know anything about C++ at all), "good software engineering sense" will tell you that the 80/20 rule applies -- 80% of your execution time will be spent in 20% of your code.

      In other words, if you're writing in a multi-paradigm language (like C++) you can avoid the cost of virtual function dispatch in the 20% of your code that is performance-critical, and for the rest, you can use virtual functions where they provide enhanced clarity and readability for your code. That's option (C), in case you were wondering.

      --
      Let's try not to let fact interfere with our speculation here, OK?
    2. Re:OOP languages are slow by Hugo+Graffiti · · Score: 1
      Basically, OOP languages like C++ and Java use this methodology, but it's obscured through friendly syntax. What we can expose from the above is:
      1. When class members change, structs change. This causes binary incompatibility between different versions of libraries. The exception is Objective-C, which looks up members based on their name in a hash table generated at run-time

      2. The addresses of branches (specifically CALL to call a function) are indirect (yes, in Obj-C too); this means that you can replace the class with another class that has the same structure but different functions being pointed at. It also means that the CPU can't do branch prediction, which hurts pipelining and intelligent CPU caching, causing pretty big slow-downs.

      For the first point, there is no "binary incompatibility" in Java. Fields are referenced in the class file by symbolic names which are resolved dynamically at runtime. See here for more info.


      Secondly, if you have a Java method whose performance is critical, you can declare it as final. This gives the JIT compiler the option to either inline the method or create a direct non-virtual link to the method.

    3. Re:OOP languages are slow by Anonymous Coward · · Score: 0

      >this means that you can replace the class with another class that has the same structure but different functions being pointed at. It also means that
      >the CPU can't do branch prediction, which hurts pipelining and intelligent CPU caching, causing pretty big slow-downs.

      I strongly disagree ! Modern cpu will detect the indirect call and optimize it as well. But you will avoid the branch prediction overhead anyway...

      look at that code :

      switch(myobject.code){
              case 1:
                    dothis(myobject);
                    break; ...
              case 100:
                    dothat(myobject);
                    break;
      }

      which code is slower ? Your's is O(n). Mine is O(1).

      an other slashdotter spoke about 20/80% rule which is absolutely true. And also, think about the time you gain by writing _clean_ code.
      clean code is easier to modify and refactor. Taking 20 minutes more to create cleaner code at the start may make you win 3 hours later.

    4. Re:OOP languages are slow by julesh · · Score: 1

      CPUs put a lot of stock in branch prediction; due to the nature of OOP languages like C++, Objective-C (I like this one), and D, this doesn't work.

      CPU designers have been working on this problem for a while now. Most modern CPUs can branch-predict C++-style code with a fairly high degree of accuracy. Prediction misses generally only occur when the class of an object being processed is different to the class of the last object to be processed. This case would likely cause a prediction miss whatever approach was taken to implement it.

    5. Re:OOP languages are slow by be-fan · · Score: 1

      You're neglecting four things:

      1) Most good OOP languages (C++ is not one of them) do type inference to statically resolve method dispatch when possible. This can either happen at compile-time or runtime depending on the implementation.
      2) Clever implementation techniques can do partial dispatch optimizations that turn indirect calls into decision tree when it can be determined that the target will always be a member of a specific set of types.
      3) Modern CPUs (both K8L and Core 2) have indirect branch predictors that'll predict data-dependent branches like those involved in indirect function calls.
      4) Indirect calls are very often necessary even in C. Look how many function pointers are floating around the Linux kernel, for example (or any kernel, for that matter).

      Really high-performance implementations of object-oriented languages (things like Concurrent Aggregates, Self, Strongtalk, Orbit) that perform very competitively with C. Even with today's generation of native-code compilers for OO languages, you can almost always get within 50% the performance of C, and often within 20%. And if you're writing code where a factor of two in a tight loop is going to be a deal breaker, then you're at the point where you're going to want to break out the assembly anyway.

      In modern implementations of highly-OOP languages like Lisp, Dylan, and Scheme, the bottleneck is more often the actual machine-code generator than the object-orientation infrastructure. I use SBCL a lot (a native-code Lisp compiler), and if you gave me the option of a perfect type-inferencer that removed OO overhead, or a low-level optimizer that generated machine-code as good as Intel C's, I'd pick the latter.

      --
      A deep unwavering belief is a sure sign you're missing something...
  74. Re:The feature-checklist school of software design by Jugalator · · Score: 1

    To me, languages like these (C# is a bit similar in some cases, even moreso the upcoming C# 3.0) offer you the tools for special circumstances, but it doesn't mean you have to use its entire toolbox in every application you develop. For example, you don't have to nest your functions as soon as you'll be able to, or even learn how to do it. However, chances are that when you run into a language problem you think "it would be damn nice if you could design a program like this" -- then some basic research of D's feature set would give you an "aha" moment and then, in that case, perhaps let you try use one of its more obscure features.

    When I think of language complexity, I think of needlessly much code to do quite little or strange design from e.g. mixing up an object-oriented design with one that isn't, which feels much more like C++'s territory than D's.

    --
    Beware: In C++, your friends can see your privates!
  75. Re:I have a problem with GC in a systems language. by Animats · · Score: 3, Interesting

    I wasn't happy about that either. Garbage collection in a language with destructors leads to wierd semantics, which is why Microsoft's "Managed C++" is a nightmare. I corresponded a bit with Walter Bright in the early days of D, but didn't press the issue.

    What seems to work in practice is reference counting. GC gets most of the academic attention, but Perl and Python are both basically reference counted, and the result seems to be that programmers in those languages can ignore memory allocation. Java programmers have to pay a bit more attention, worrying about when GC will run and when finalizers will be called. Reference counting is deterministic; the same thing will happen every time, so timing is repeatable. That's not true of GC.

    There are two basic problems with reference counts - overhead and cycles. Overhead can be dealt with by hoisting reference count updates out of loops at compile time, so that you're not frantically updating reference counts within an inner loop. Hoisting (along with common subexpression elimination), by the way, is also the answer to subscript checking overhead.

    Cycles are a more serious problem. Conceptually, the answer is strong and weak pointers (in the Perl sense, not the Java sense), which allows the programmer to express things like trees. (Links towards the leaves should be strong pointers; back pointers towards the head should be weak pointers.)

    In practice, cycles aren't a serious problem, because they're generated by design errors and tend to happen in normal program operation, so they show up early in testing as memory leaks. Dangling pointers, on the other hand, tend to show up in error cases, which is why they survive testing to become delivered bugs.

    Ideally, you'd like to detect cycles at the moment they're created, at least for debug purposes. This is quite possible, although there's substantial overhead.

    Attempts to retrofit reference counting to C++ via templates have been made, but they are never airtight. To get anything done, raw pointers have to leak out, which makes the reference counting scheme very brittle.

  76. Re:Erm how is this better.. by TheGavster · · Score: 2, Insightful

    Sodding lot of good that does if the vendor of the VM is only going to build for Windows.

    --
    "Because Science" is one step from "Because old book". Try "Because of my experiment testing my falsifiable assertion".
  77. Re:Erm how is this better.. by pdbaby · · Score: 1
    Neither runtime safety checks nor a logical standard library have anything to do with a VM though

    I was meaning more of a "do no evil" sandboxing safety check: allowing you to restrict file IO, etc. on a per-method basis

    --
    Global symbol "$deity" requires explicit package name at line 2. - If only $scripture started "use strict;"
  78. Re:Erm how is this better.. by Anonymous Coward · · Score: 0

    I have mod points and considered modding you up to 0 with underrated but
    your argument is centered more around Microsoft's Ersatzjava than the
    point you're superficially trying to make about the language lacking a
    vm implementation. Hence the verdict of the original moderators is more
    than fair.

    Why don't you post that same argument without making any reference to any
    vendors implementation?

  79. Re:The feature-checklist school of software design by Anonymous+Brave+Guy · · Score: 2, Interesting

    Perhaps accidentally, you've just hit on one feature of programming language designs that I think does justify a new compiler front-end: ease of parsing for use with tools. Parsing the current monsters like C++ and Perl is so awkward and error-prone that few tools even get simple things like syntax highlighting 100% right (and the performance of those that do is... less than stellar). I imagine most of us are more interested in the underlying semantics of programming languages than in the specific syntax anyway, so can't we use a grammar that is easy to parse effectively, and then have tools from syntax highlighters to source code navigation to refactoring working quickly and reliably for a change?

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  80. Re:Erm how is this better.. by Generic+Player · · Score: 1

    That still has nothing to do with a VM though. What is wrong with a compiler generating the same runtime checks in the machine code it outputs? Just because languages that do this are typically bytecode compiled languages, doesn't mean it can't be done in machine code compiled languages too.

  81. Re:Erm how is this better.. by pdbaby · · Score: 1

    Except you have to trust the compiler to emit that code; the security is essentially for the benefit of the program, not the user. Having all that extra information (and the ability to selectively deny some bytecode from being executed) is what really sets the VM above a natively compiled app. Doing the same with x86 would be very complex (and as a result probably very easy to bypass)

    --
    Global symbol "$deity" requires explicit package name at line 2. - If only $scripture started "use strict;"
  82. Re:Erm how is this better.. by Generic+Player · · Score: 1

    You already have to trust the compiler and the VM. What user is getting what benefit? The programmer already relies on the compiler and VM and libs, relying on just the compiler and libs is no different. The person running the code gets no guarentees either way, a VM doesn't protect him at all, unless he compiles the VM and the bytecode himself. He would get the same protection from the theoretical machine code compiler.

  83. Re:Erm how is this better.. by pdbaby · · Score: 1

    I'd have to disagree -- I see your point that technically there's no reason to trust the VM (you don't need to trust the compiler since your VM verifies the code anyway, and you make the decision [at least theoretically] to trust an app to access certain parts of your system), there is however, I think, reason to trust the VM: the vendor's reputation lies with the security and integrety of their vm (and their trusted libs).

    A good example of this is Microsoft's XNA system: it lets programmers run .NET bytecode on the xbox 360. They have restrictions in place in the vm (such as denying ethernet and dvd access). They don't trust the programmer or the compiler, but the VM ensures that nothing bad happens. They don't allow PowerPC code -- I assume this is because it'd be very difficult (to impossible) to prevent native code from doing what it wants (the .NET bytecode is jitted, so I don't think they went the .net route to degrade homebrew performance). If their VM was compromised they'd be screwed, because the first native instructions would probably be lilo

    --
    Global symbol "$deity" requires explicit package name at line 2. - If only $scripture started "use strict;"
  84. Re:Another 'Toy' Programming Language by Diabolus777 · · Score: 1

    so in canada we can. This is were I graduate this summer:
    http://www.etsmtl.ca/english/index.html

    the software engineering degree is acknowledged by the BCAPI.
    http://www.ccpe.ca/e/ccpe_boards_2.cfm

    more info there about the differences between comp sci, IT eng, software eng, electrical eng, etc:
    www.computer.org

    --
    We should have been
    So much more by now
    Too dead inside
    To even know the guilt
  85. Re:Erm how is this better.. by ZenShadow · · Score: 1

    No, GP was not correct, and neither are you. Yes, CF was originally Java based, and they used to use CF. No, they are not using CF on Java. I'll leave the rest for you to research and figure out, but I do know what I'm talking about here.

    Aside from that, "Java app" != "CF app", whether or not CF runs on Java.

    --S

    --
    -- sigs cause cancer.
  86. Re:The feature-checklist school of software design by stevenj · · Score: 1
    it doesn't mean you have to use its entire toolbox in every application you develop

    Lots of people have made the same argument about C++. The problem is that every programmer uses a different subset of the language, so you end up having to deal with the whole mess in a program of any real size.

    It's a bad sign if you have a language that is so large, you have to start imposing artificial constraints like intentionally subsetting the language or following "design patterns" in order to manage the complexity.

    --
    If a thing is not diminished by being shared, it is not rightly owned if it is only owned & not shared. S. Augustine
  87. Re:Erm how is this better.. by Heembo · · Score: 1

    You bloody moron, MySpace is way more than just www.myspace.com.

    --
    Horns are really just a broken halo.
  88. Attitude of promoters puts me off by noidentity · · Score: 1

    I remember seeing Usenet messages about D many years back, but I was always put off by the tone of the messages, always one of superiority. Those aren't the kind of people I want to deal with when asking questions about a new language or discussions about the technical advantages and disadvantages of constructs. Every time I brush up to something about D, I always encounter this tone and turn away.

    1. Re:Attitude of promoters puts me off by Workaphobia · · Score: 1

      I remember one time when I was going through hell with D because the libraries I needed were apparently not available in the format recognized by the D linker. After a lengthy explanation of my limited understanding of the problem, the only reply I got was Walter informing me that for $25 I could get the library from his CD. Not quite the same problem as yours, but annoying nonetheless.

      --
      Evidently, the key to understanding recursion is to begin by understanding recursion. The rest is easy.
  89. Re:Erm how is this better.. by Generic+Player · · Score: 1

    Microsoft is not a user, your xbox example is about preventing users from using their own system. And while I am sure they didn't go the .net route specifically to degrade performance, the choice does degrade performance, jit compilation does not make it as fast as native. For what its worth, you can do the same thing with native code if you want, using the OS to restrict access. You could make an OS that will only execute "trusted" executables normally, and everything else gets limited access where many syscalls are denied. You could do this with selinux or any other similar system. None of this requires a VM at all, its just things that have been implimented in existing VMs. That does not preclude them from being implimented without a VM.

  90. Re:This won't work... D Strings by Anonymous Coward · · Score: 3, Informative

    While D strings are mostly implemented as character arrays, it works quite differently than C. Here are some notable differences:

    - D arrays are bounds checked. No accidental buffer overflows here.
    - D arrays are dynamic, you can resize them and concatenate them together.
    - D strings are D arrays, so they get the above bonuses.
    - D has distinct 'char', 'byte', and 'ubyte' types. char[] != ubyte[]. When you use foreach to iterate over a char[]/string, it will expand each codepoint (or whatever they are called) to a dchar (which is a 32 bit character) for you. ubyte and byte are used for plain-old-data, instead of the unfortunate C char.
    - Garbage collection frees you from worrying about where the strings go. No accidental memory leaks here.

    There is also a nice alternative to the plain old strings called dstring, which gives you even more benefits of d's arrays like indexing and slicing (you can safely leave foreach alone with it). http://www.dprogramming.com/dstring.php

    I've used both D strings and C strings, and D's strings just felt so much better.

  91. Huh? Not too sure.... by woolio · · Score: 1

    CPUs put a lot of stock in branch prediction; due to the nature of OOP languages like C++, Objective-C (I like this one), and D, this doesn't work. The way virtuals and class inheritence works, functions are necessarily dealt with as pointers; the function is pointed to by pointing to a master class object, basically.

    Well sorta but not quite...

    But I think it is often not so bad... Moderns CPUs also can do "branch target prediction" which allows them to predict *where* an indirect branch will go (and not just *if* it will be taken). These predictions are be based upon the address of the branch... (So "class X" calling virtual methods on an List on Java *could* actually be done pretty well since the same code is always calling the same "List" methods). (Disclaimer: I deeply hate Java and try to avoid it)

    And in C++ there is only need for a method to be virtual if it will be overridden... High performance code can just use templated objects instead of virtual functions. (such as the STL library in C++ with its flexibliity in iterators, allocators, and comparators). Object-oriented techniques are often not really needed at *runtime* and serve to make coding easier... (One could write a C++ program involving inheritance, base classes, and several different objects without ever using a virtual function... The compiler would know exactly what should happen... The OO techniques would server to make coding simpler, more readable, etc, etc)

    I think you wrote your "#2" thinking about a function that processes different objects at runtime... I agree that this cannot be done efficiently, but I think this really represents a program design flaw rather than a programming language design flaw... If a program should be processing a large number of objects whose exact types are unknown at runtime, wouldn't it be better to first group them and them process them by type? (This would allow branch prediction to be done effficiently). Of course, this might be more difficult to implement depending on the application...

  92. Re:IDE D's Language Features by ChrisNSauls · · Score: 1

    First off, which came first, the language or the IDE? (Answer: language. I'm pretty sure no one had an IDE to write Assembly or COBOL in, back in the day.) Secondly, here's a list of known Editors that may be used with D: http://www.wikiservice.at/d/wiki.cgi?EditorSupport I've been personally using EditPlus2 to write D source for a few years no with no issue. I haven't even missed auto-completion or tips. Building has also been straight-forward, thanks to the written in D for D make utility "Build" (now commonly referred to as "bud"). And of course, traditional make works as well, if you feel so inclined.

  93. P language by Anonymous Coward · · Score: 0

    I'm mostly surprised that noone has thought of a (P)rogramming language. :) It'd probably be piss poor like Java.
  94. Re:Erm how is this better.. by pdbaby · · Score: 1
    Microsoft is not a user, your xbox example is about preventing users from using their own system

    It's always seemed to me that in DRM, the end-user isn't really the user in the system's spec. Although terminologically, the "user" is still setting the vm restrictions... just for a different value of user :-)

    None of this requires a VM at all, its just things that have been implimented in existing VMs. That does not preclude them from being implimented without a VM.

    Well that's certainly true, but VMs do have the nice side-effect of having to compromise VM and OS security (as well as allowing heterogeneous real environments). I still maintain it'd be incredibly difficult to implement a native code security policy compared to a VM security policy

    --
    Global symbol "$deity" requires explicit package name at line 2. - If only $scripture started "use strict;"
  95. Re:IDE D's Language Features by trimbo · · Score: 1

    Right, back in the day, we used to write assembly in hex and use BSAVE it to floppy. I'd like to imagine we've gotten somewhere since 1982. It was long before we had enormous APIs that we code around like we do today. We used to do sound by toggling $C030. Comparing those development processes to today's is absurd.

    Given that C# and C++ serve our needs pretty well, I'd like to start looking at new languages as a whole development package rather than some syntactical sugar that might shave off 5 minutes on "Hello World". We live in an era where the languages matter far less than the development process -- at least on the level I'm talking about. When you're writing in EditPlus, it's no easier to write and manage 1m lines of code in D than it is in C++ or Python. I'd love to see someone to prove otherwise.

  96. Re:I have a problem with GC in a systems language. by thona · · Score: 1, Insightful

    ::Garbage collection in a language with destructors leads to wierd semantics, which is why Microsoft's "Managed C++" is a nightmare.

    Really? I had to use Managed C++ for a part of a .NET project some time ago. Basically we used ISDN low level programming, and without an interpreting SDK the bytestreams of the messages are a pain in the ass to work with, and all SDK's are for C++, so we created a nice object model in Managed C++ that the C# main application could then use.

    I found the managed C++ syntax tio be pretty nice, given the constraints of C++ to start with. Damn nice, to be exact. ::What seems to work in practice is reference counting

    What does NOT work, is reference counting, except in the eyes of some programmer without a clue. Reference counting can not be used for any caching that should release items under memory pressure (which I happen to write a lot), and reference counting is deadls in case you have systems like a pointing to b pointing to c pointing to - a. Circular references get never collected.

    Happens a lot to me. I often build trees of objects (A contains a list of childs, contains a list o childs) and any object has a pointer up to it's parent. Normal GC will release the whole tree the moment it is not reachable anymore, a "oh so working" reference counting GC will happily keep htat crap in memory, as there are always references.

    SOmehow your programs seme to be simplistic - I run weak references and circular references basically in every project I do. But then, I work on database middleware, not exactly primitive web pages.

  97. Re:IDE D's Language Features by donglekey · · Score: 1

    I agree that the entire development process is the big picture. I think D needs an installer that takes care of the compiler, ide, and creates a templated project for you so that there is no barrier to getting a problem to work. Make no mistake that D is good technology, though I agree that this is where effort needs to be put right now.

  98. C++ templates by Anonymous Coward · · Score: 0

    The usual complaint is that C++ templates are too powerful (a Turing-equivalent compile time language).

    I've never heard anyone complain that a language feature is too powerful. But C++ templates got so powerful by accident rather than by design, and any nontrivial metaprogramming with them requires fiendishly ugly code.

  99. Re:Erm how is this better.. by JamesNK · · Score: 2, Informative

    Actually MySpace runs on .NET - Handling 1.5 Billion Page Views Per Day Using ASP.NET 2.0

    Apparently the move to ASP.NET went quite well with CPU usage dropping from 85% to 27% according to that post.

  100. Re:Erm how is this better.. by Heembo · · Score: 1

    MySpace is in the process of developing Java5/Hibernate3.2/Wicket applications.

    --
    Horns are really just a broken halo.
  101. The H programming language by Joseph_Daniel_Zukige · · Score: 2, Funny

    would be popular in Japan, I'm sure.

    Especially among teenagers and otaku. (And geeks who think that otaku is equivalent to geek.)

  102. combining characters by Joseph_Daniel_Zukige · · Score: 1

    are the only problem you mention of substance.

    They are a problem of substance, however.

    Unicode is not the solution it should have been, and surrogate pairs is the evidence of why.

    1. Re:combining characters by spitzak · · Score: 1

      I believe Unicode does have problems, but "surrogate pairs" is strictly a problem with the UTF-16 encoding chosen by Microsoft (and by the Unix companies before that) because they failed to realize the impossibility of having fixed-size characters. Plan9 chose UTF-8. Linux pretty much chose it as well, I would like to think it is because they were smart, but the main reason is that it is enoumously easier to implement UTF-8 on an existing system than to add "wide characters".

      Unicode's problems are chiefly the insistence that all existing character sets have a lossless translation from/to Unicode. This is why there are hundreds of combined character+accent mark glyphs, when it would be a lot easier for everybody if only decomposed characters were supported. I think there may be similar problems with all the pictrograph characters for Chinese and Japanese, in that they could instead be "composed" of several "stroke" characters, but I certainly can't say anything about languages I know nothing about.

      A good deal of problems with Unicode and encodings I think stem from a politically-correct view that it is somehow bad if the Americans get the "better" short characters. Thus the insistence that things all be equal-sized when stored and that characters be composed.

  103. Yes please by Geeselegs · · Score: 1

    built-in unit testing and design-by-contract This would be as nice as a programming language with inherant multi-processing and data protection.
  104. Types by Trejkaz · · Score: 1

    Another feature which wasn't mentioned is that similarly to Java, types in D are generally sized in a standard way. It's not like C where an "int" might be 2 bytes on one platform, 4 on another and 8 on yet another. And unlike Java, they don't sacrifice the unsigned types.

    --
    Karma: It's all a bunch of tree-huggin' hippy crap!
  105. Re:I have a problem with GC in a systems language. by Anonymous Coward · · Score: 0

    Agreed. The main problem with GC is that it almost solves the wrong problem.

    The problem GC attempts to solve is memory leaks. Memory leaks occur when there is a divorce between the semantics of two operations, one of which consumes a memory dynamically (the allocation), and the other which is required to clean up the consumption (the deallocation). This is a subset of another issue--handling resources (e.g., open a file, you must close it; lock a mutex, you must unlock it).

    The problem is bigger than "new" and "delete" type semantics, which garbage collection addresses. If you consider a linked list in java, for example, you have the potential for memory leaks (allocation in the list, removal from the list). So java will "probably" clean up your news--big deal. You have the same exact problem popping up again in any data structure. If you can forget to delete, you can forget to erase.

    The proper way to address this issue is to use RAII. The RAII approach requires the language to support resource cleanup semantics. This is why java sucks so bad--you can't do RAII. But you can in C++. And you can in D.

  106. Basic syntax.. by SuperDre · · Score: 0

    Now if only it had the Visual Basic syntax... I've worked with so many languages, but I have to admit that I find the VB syntax the most 'clean'(readable) syntax there is.. But I wish the creators of 'D' a lot of luck with their 'new' language.. ;)

  107. GDC source is not 64-bit clean by The_Dougster · · Score: 2, Informative

    I've been messing around for a couple hours now trying to compile gdc against gcc-4.0.3 in Gentoo amd64 and it's just not happening. I ran into an issue where it had a int and size_t mismatch, an undefined cpu symbols macro, and after hacking these the build died complaining it thought that I was cross-compiling gcc.

    I've given up for now. Maybe if D hits the 1.0 magic number somebody will fix it for 64-bit systems and add it to portage. Oh well, I would have liked to start playing with D but I guess I'll just have to wait.

    --
    Clickety Click ...
    1. Re:GDC source is not 64-bit clean by JM+Apocalypse · · Score: 1

      See http://dsource.org/projects/gentoo/wiki/LaymanSetu p for a portage overlay that includes DMD-bin. You have to edit the layman configuration and disable warnings about missing fields, but it works fine after that.

      --

      - - - - - - -
      Orppf urp mf y.ppcxn. yflcbi otcnnov C am yflcbi yr n.apb Ekrpatv (Dvorak -> Qwerty)
    2. Re:GDC source is not 64-bit clean by The_Dougster · · Score: 2, Interesting

      See http://dsource.org/projects/gentoo/wiki/LaymanSetu p for a portage overlay that includes DMD-bin. You have to edit the layman configuration and disable warnings about missing fields, but it works fine after that.

      I tried it, and it added the package, but it is masked by missing keyword. Besides, I don't want to install dmd, which is the 32bit compiler from digital mars, I'd rather have the gcc addon gdc built into my existing 64bit compiler system. I currently don't have the 32bit emulation libs installed, and I don't plan on installing them either. I have a pretty cool system going that is 64bit clean and runs like my own personal supercomputer. I'm into engineering, science, and mathematics programming, so I really like the free extra precision with 64bit and sse3 not to mention the extra cpu registers.

      I might try and compile D (gdc) into /usr/local/gcc-4.0 again just to see if I can get it to work, but it is obvious that some patches need to get sent upstream for the amd64 platform. I'm not sure how best to implement the patches, but I would think that it should be done using autotools, and that config.h mechanism.

      --
      Clickety Click ...
    3. Re:GDC source is not 64-bit clean by The_Dougster · · Score: 1

      As an update, I got further along this time, but compilation died when gcc tried to compile libphobos with the oddest autotools bug I've ever seen. Here's what I did:

      Download and unpack gcc-4.0.3 into your personal src dir

      Download the svn trunk of gdc from http://sourceforge.net/projects/dgcc

      Go into gcc-4.0.3/gcc

      $ cp -a ../../dgcc/trunk/d .

      $ cd ..

      $ gcc/d/setup-gcc.sh

      $ mkdir work

      $ cd work

      $ ../configure --prefix=/usr/local/gcc-4.0.3 --enable-languages=c,d,c++ --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --disable-multilib

      edit ../gcc/d/d-lang.cc and change the following on line 268

      #ifdef D_CPU_VERSYM
      VersionCondition::addPredefinedGlobalIdent(D_CPU_V ERSYM);
      #else
      #define D_CPU_VERSYM "unknown"
      #endif

      Run "make"

      Compilation dies on libphobos with the following peculiar error:

      checking for nan... yes
      checking for exp2... yes
      checking for log2... yes
      checking for fpclassify and signbit... yes
      configure: error: Missing fpclassify and signbit
      make: *** [configure-target-libphobos] Error 1

      Well, I'm getting further along. It would be nice to get D working in gcc, no doubt its more usefull than Objective-C. lol.

      --
      Clickety Click ...
  108. Stack allocation by igomaniac · · Score: 2, Informative

    Deciding how to allocate an object you create would better be left to the compiler. It's not a hard analysis to do to make sure the reference to an object never escapes a particular (possibly recursive) function call, and in that case the object can be allocated on the stack. Leaving this decision to the compiler makes sure that if someone changes the code you're calling so it suddenly starts to keep references to the objects that you've allocated on the stack and are passing in, it won't break. In big C/C++ programs, this kind of error is quite common since it takes a lot of time to track down all callers to a function you're modifying and understand their allocation patterns. Tracking down errors like this can be extremely time consuming and programming languages that allow these errors are in my opinion wasting valuable programmer time that could be spent optimising code instead.

    --

    The interactive way to Go -- http://www.playgo.to/iwtg/en/
  109. Re:The feature-checklist school of software design by Anonymous Coward · · Score: 0

    I disagree that ease of parsing has a big impact otherwise we would all use Lisp..

    OTOH, there is probably a good middle ground between Lisp and overly complicated syntax like C++ or Perl.
    D or Scala fits in this description.

  110. Re:Erm how is this better.. by ZenShadow · · Score: 1

    No shit, Sherlock.

    http://www.fusionauthority.com/Community/Article.c fm/ArticleID:4477

    You're fighting a losing battle on this one. You might be surprised at what they run (and don't run) over there, in spite of appearances.

    --S

    --
    -- sigs cause cancer.
  111. Re:Erm how is this better.. by ZenShadow · · Score: 1

    I would *love* to know where you got that from. Care to provide a source?

    --S

    --
    -- sigs cause cancer.
  112. P-code by Per+Abrahamsen · · Score: 1

    P-code was a popular VM a few decades before anyone thought of JVM as a new revolutionary concept.

  113. Re:Erm how is this better.. by ZenShadow · · Score: 1

    I rather like your link a lot better than the one I posted. :-) Thanks for that...

    --S

    --
    -- sigs cause cancer.
  114. Re:Erm how is this better.. by Anonymous Coward · · Score: 0

    That's Common Language Runtime and MSIL (Microsoft Intermediate Language). Also, MySpace was never front-ended by Java; they were ColdFusion 5 and opted to convert to BlueDragon.net running on ASP.NET 2.0 instead of moving to CF6/Java. I can't believe you bothered to post that crap.

  115. D LOC, bugs vs. C++ by Ignominious · · Score: 1
    When you're writing in EditPlus, it's no easier to write and manage 1m lines of code in D than it is in C++

    Although it may be that 1m lines of D code can do more than 1m lines of C++ code:

    http://www.digitalmars.com/d/lisp-java-d.html

    "For C++, the shortest development time was 3 hours and the shortest program had 107 lines of code."
    The D implementation "took me 1 hour and 15 minutes, from reading the statement to finishing the program. The program was just 55 lines long"

    Of course, that is just one example, but I think it reveals something about the D language - it was designed to have clearer syntax and to be harder to write common bugs than C++ code.

    YMMV.
  116. Design by contract by Taagehornet · · Score: 1

    MS provides a rather neat extension of the C# language: Spec#.

    Spec# adds the method contracts and class invariants of Eiffel, the checked exceptions of Java, and introduces non-null types. But the thing that at least I find the most interesting, is the idea of static program verification.

  117. It looks like a nice language, but by jimstapleton · · Score: 1

    looking at the comparison:

    C/C++ do have try-catch-throw stuff now I thought (it says they don't)

    D doesn't have multiple inheritance, that is my biggest problem when programming .NET or Java - having to program the same sets multiple times due to a lack of multiple inheritance - basically once for each combination of a set of features that can occure together or separately.

    --
    34486853790
    Connection too slow for X forwarding? Try "ssh -CX user@host"
    1. Re:It looks like a nice language, but by eluusive · · Score: 1

      D fixes this with mixins and interfaces. C/C++ try-catch-throw stuff is lacking several important features. Such as Finaly, and some other nifty features D has. Check http://www.digitalmars.com/d/exception-safe.html

    2. Re:It looks like a nice language, but by Anonymous Coward · · Score: 0

      C doesn't hav try/catch/throw. C++ does.

    3. Re:It looks like a nice language, but by ChrisNSauls · · Score: 1
      Multiple Inheritance is an often abused feature which is also a source of difficulties when it starts to get deep. (And problems arising out of diamond inheritance, etc.) Granted, it has its moments of usefulness. For those special moments, a D interface will usually suffice. And if you happen to know that a majority of implementations are going to be the same, you can define a standard implementation in the form of a mixin template. Convoluted example:

      interface IWhatever {
      int foo (int) ;
      int bar (int) ;
      }

      template StandardWhatever {
      int foo (int n) { return n * 2; }
      int bar (int n) { return foo(n) + 2; }
      }

      class Typical : IWhatever {
      mixin StandardWhatever;
      }

      class Special : IWhatever {
      int foo (int n) { return n * 3; }
      int bar (int n) { return foo(n) - 1; }
      }
      Mixins have certain additional features in that 1) they are templates, and therefore can be generic and/or take template parameters, and 2) they can be named. An example of this is in the Signals/Slots module of the current standard library (Phobos).

      import std.signals ;

      // class Foo is itself a signal with an int parameter
      class Foo {
      mixin Signal!(int);
      }

      // class Bar contains two signals, one taking an int and the other a char[]
      class Bar {
      mixin Signal!(int) alpha;
      mixin Signal!(char[]) beta;
      }
  118. Next big thing by born4fun · · Score: 1

    So, what will we see next? D#? E++? Or some other F*** language? :)

  119. Mod parent up. by mrmeval · · Score: 1

    You crack me up. :)

    Look up dirac beep. If you already know it give yourself a thousand scifi geek points. :)

    --
    I'd go on a Vegan diet but the delivery time from Vega is too long. --brownkitty
  120. Re:The primary reason for stack class allocation.. by TheRaven64 · · Score: 1
    Thanks for the post, very interesting. I am still not quite sure, however, what the difference is between the following two cases:
    1. Allocating objects on the interrupt handler's stack.
    2. Allocating objects in a zone that is reserved for the interrupt handler.
    It seems that the first is just a special case of the second, where the zone is also used for other things, such as the return address[1]. With Objective-C, at least in the GNU implementation (not in the Apple implementation any longer, sadly), you can define a zone which is a simple wrapper around alloca, so that you are allocating objects on the stack. This is a library feature, however, not a language feature, which is what I was saying to the original poster; it's better to have a small language that allows you to easily extend it to do things that the designers might not have thought of than a big inflexible one.

    The one feature I see in D that Objective-C lacks is a good template mechanism; being a dynamic, late-bound language, the assumption with Objective-C is that anything you would do with templates, you would do at run-time. While this is very flexible, it looses something in terms of speed, and means you can't do a lot of the nice meta-programming things at compile time that you can with a language like Lisp. This is not a problem for a language like Smalltalk, because Smalltalk is designed to run in a VM, so JIT compilation blurs the boundaries between compile time and run time a lot, but Objective-C does not have this luxury.


    [1] As an aside, I consider having unified control and data stacks a design flaw in a language, but that's a different issue.

    --
    I am TheRaven on Soylent News
  121. Delphi? by CrazyTalk · · Score: 1

    I remember when Delphi 1.0 came out in the mid 90s - people refered to it as "D" - it had the power of C++ in terms of being fully object oriented, allow for pointers (unlike VB) etc. yet was easier to use, especially for RAD. In short - been there, done that.

    1. Re:Delphi? by cnettel · · Score: 1

      No templates, no multiple inheritance, no C syntax compatibility (although some things are quite trivial to translate between C and Pascal).

    2. Re:Delphi? by CrazyTalk · · Score: 1

      Ummm...and why would you want C syntax compatiblity? Also multiple inheritance == bad (although that is somewhat of a religous war). I will agree with you about no templates - but then again, we are talking about 1994 technology.

  122. D-links by SlashGet · · Score: 1

    I don't like the links in this post, they are D-links...

  123. Ruby more productive than Smalltalk? Back that up! by Anonymous Coward · · Score: 0

    Smalltalk is /famously/ productive - I don't know why it fell out of favor but, if you're making the claim that Ruby is more productive casually, I think you're mistaken. Ruby may be easier to learn for someone who knows another language and be in /that/ sense more productive, but I'd be careful of going around saying Ruby is more productive.

  124. Re:Another 'Toy' Programming Language by Anonymous Coward · · Score: 0

    Well, Canada is a good example: Before being able to legally call yourself and engineer (yes, this includes a software engineer), you need to have graduated from an engineering program accredited by the Canadian Engineering Accreditation Board. Once you graduate, you need to pass an exam and an interview from the engineering regulatory body in your province (for instance, in Ontario, it would be the Professional Engineers of Ontario). Only once all of this has been achieved, you can legally call yourself an engineer.

  125. Re:Another 'Toy' Programming Language by Interl0per · · Score: 1

    Suitable I should think, for "I.T" projects, cobbled together by cable-pullers, thinking they are actually programmers. Elitist much?
  126. c and perl by XO · · Score: 1

    This appears to be what happens when you take the ASCII-puke aspect of Perl out, and then combine it with a bunch of weird stuff. I understand C, C++, Java, PHP, and I can't follow that at all.

    --
    "Champagne for my real friends - and real pain for my sham friends!" http://ericblade.postalboard.com/
  127. Mac? by pubwvj · · Score: 1

    What, no Macintosh version? Boooring.

    1. Re:Mac? by Anonymous Coward · · Score: 0

      You, sir, are a twit.

      http://gdcmac.sourceforge.net/

  128. how many one letter languages? by peter303 · · Score: 1

    Other I remember include:
    "S" from Bell Labs for statistic analysis package.
    "W" at Stanford for UNIX bitmap graphics window software circa 1985.
    "X" at Stanford for client-server graphics "extended" software from same Stanford research group.
    "X" and "W" were combined into XWindows and managed at MIT for many years.

    All three of these were plays on UNIX's "B" and "C" language naming.

  129. Fell out of favor? by Generic+Player · · Score: 1

    It was never in favor, pretty hard to fall out. Its fairly obvious that ruby is more productive, go try it. Its a higher level language with more high level abstractions. This isn't taking anything away from smalltalk, which has better development tools and unlike ruby is actually fast enough to be used for non-trivial tasks. But ruby is more productive.

  130. Good Luck! by ThePhilips · · Score: 1

    Good Luck lobbying the new language.

    Piece of advice - especially since D boasts linking compatibility with C/C++ - is to start using it in existing C/C++ projects (along with C/C++) to pilot it in real world applications.

    C is fine as it is - it fits its designers' purpose. But C++ really annoys me. I am all for C compatibility, but in the end, some C++ projects start looking like written in C and vice versa: some C projects build completely on OO paradigms. (Just recall GTK & GNOME.) Ojective-C often fits the bill but few know about it.

    Also, as Perl programmer, I welcome inclusion of primitive data structures ("associative arrays, array slicing") into language itself. C++' STL really does good job obfuscating programs up to the point of complete unreadability. Also its syntax makes any kind of serious programming really hard: you cannot make STL using code both readable and optimal. Overloaded operators is curse.

    --
    All hope abandon ye who enter here.
  131. Exactly by ebuck · · Score: 1

    I mean, when do you ever hear of a tape-recored language? The processing, storage, and transmission of a language is somewhat independent of the language's grammar.

    Sorry, but this is written in an email language. You'll have to render it to a pixel language to display on a CRT, and then illuminate it as a light emitting visual language for eye processing.

  132. A constructor is not just another (static) method by gidds · · Score: 1
    At least, it's not in the few OO languages I know.

    There's all the stuff about making sure the superclass constructors are called, in the right order. Getting members initialised, in the right order. Coping with exceptions (and knowing when the object is 'live' and will need to be garbage-collected). In a language like Java with inner classes, it'll mean keeping track of the enclosing instance. And so on. A constructor may look superficially like another method, but it's not, and trying to pretend it is has more at stake than a 3-letter keyword.

    What you're describing looks more to me like a factory method. This can do things no constructor can: in particular, it may return a subtype of the advertised type. It may also return a reference to an existing instance, rather than creating a new one, to allow for object sharing or reuse.

    Both constructors and factory methods have their uses, but I wouldn't want to see them confused.

    --

    Ceterum censeo subscriptionem esse delendam.

  133. I think you'll find it doesn't. by Anonymous Coward · · Score: 0

    D may have many qualities, but orthogonality is not one of them.

  134. Ehm. by Anonymous Coward · · Score: 0

    The combination of a MMU with memory protection and a CPU with >1 rings is a VM. All new x86 and x86_64 CPU's even use a different instruction set (RISCish) internally than they expose to the programmer.

  135. yes, i am five. by Skye16 · · Score: 1

    I will *not* code in P.

    I won't code in poop either.

  136. Try this one then... by tchuladdiass · · Score: 1

    Well, you might like 2e then, esp. once I add some object oriented capabilities to it. I designed it to be super simple (it is mostly just an expression evaluator), yet flexible enough. Currently only interpreted, but I may eventually code up a compiler for it (most likely using C as the intermediary language).

  137. Sillyness aside, I can't find the licensing info by gmezero · · Score: 1

    What is the licensing for this language? I've found lots of copyright notices, but no licensing information.

  138. Re:The feature-checklist school of software design by arevos · · Score: 1

    What's easy for a computer to parse isn't necessarily easy for a human to parse. Languages that have a very simple syntax, such as Lisp, can be difficult for people to read because of their homogeneity.

    Now, this doesn't apply in all cases, of course. A lot of languages have syntactical cruft they've picked up from their ancestors (those that can trace their lineage back to C tend to be the worst offenders). However, I think there's an advantage to some complexity, if used correctly, and if this makes it a little difficult to create syntax highlighting, then perhaps that's a reasonable trade off.

  139. Re:Erm how is this better.. by Heembo · · Score: 1

    Oops, bad example be be. BUT there are still large sections of MySpace "under the hood" that are pure Java, your shit for brains A-hole.

    --
    Horns are really just a broken halo.
  140. Re:Erm how is this better.. by Heembo · · Score: 1

    There are major problems in terms of COST to run .NET for such a large website, which is why the JAVA faction inside of MySpace is gaining ground. Already, there are major portions of MySpace coded in Java AND .NET. (CF stuff is long gone). Look, calling you an A-hole aside, I'm not joking around. MySpace is a hybrid of .NET and JAVA, with the JAVA camp gaining ground.

    --
    Horns are really just a broken halo.
  141. Re:The primary reason for stack class allocation.. by Anonymous Coward · · Score: 0
    [1] As an aside, I consider having unified control and data stacks a design flaw in a language, but that's a different issue.


    We can resolve this by effectively eliminating the control aspect of the unified stack by translating everything into a continuation passing style and ignoring any control mess (no funcall return information will ever be used) on the unified stack.

    If we can precisely discriminate between control data and object data in the stack, we do not even have to waste time proving the deadness of any control pointers, should we wish to do garbage collection.

    (An easy approach would be to copy all the live (or probably live if we have to use an imprecise discriminator) data from the stack to the heap at intervals and flush the stack (i.e., reset the stack pointer)).

    A number of PUSH-y implementations of languages amenable to being (re)written in CPS have been made for experimental and academic reasons, in part because they can easily share stacks with other languages, which makes it easy to compile into a variety of intermediate languages (like those supported by gcc, for example),
    and there are one or two examples with extensive and useful libraries.

    Finally, for my part I think it's unfortunate that hardware support for stacks is almost always a pointer to the end of a linear array, rather than a pointer to the head of a singly linked list.
  142. Re:A constructor is not just another (static) meth by Anonymous Coward · · Score: 0

    >Both constructors and factory methods have their uses, but I wouldn't want to see them confused.

    Why not?
    You say that constructors are different than normal methods because they do lots of stuff, but factory methods usually also call a constructor behind the scene to build the object which is returned so while normal class methods they do the same thing usually, so why make an artificial difference?

    I really like the syntax
    var cl = CmdLin.new(argc, argv); //in D it is auto not var, but auto isn't a good keyword.

    Simple, consistent, and still with 'new' which can be easily seen/searched.

  143. Re:The feature-checklist school of software design by Anonymous+Brave+Guy · · Score: 1

    Oh, I agree entirely that parsability by machine is not the first priority for languages -- far from it, in fact.

    However, I think there is a strong correlation between easily machine-parsable languages and languages that don't have special cases and traps for the unwary all over them, probably because simplifying the formal grammar tends to help both goals.

    Consider Perl, for example: it's often criticised for being "write-only" on account of the complexity of its syntax, and often for having quirks and only a reference implementation to define it rather than a formal standard. It's also a nightmare for other tools to parse for exactly the same reasons, and consequently it has relatively poor support from tools other than those that come with it by default.

    Consider C++: it's often been criticised in recent years for the cumbersome syntax of its templates, and to give credit where it's due, the D language does seem to do this rather more neatly. C and C++ are also often criticised for their frankly bizarre declaration syntax, particularly where pointers, arrays and functions are present in combination. The classic is the difference between

    MyClass c;

    which defines an object c of type MyClass and default-constructs it, and

    MyClass c();

    which defines a function c that takes no parameters and returns an object of type MyClass. This sort of nonsense is just as much a pain for the human reader as for the language tools that need to disambiguate.

    Other languages have similar issues. Thus I don't see that simplifying the formal structure of language to make tool development easier is necessarily in conflict with making the language easier for humans to use. If anything, the opposite is true.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  144. Re:I have a problem with GC in a systems language. by Anonymous Coward · · Score: 0
    I used to think that, too, until I was forced into working with a GC. I've changed my mind. ...

      All I can suggest is try using a GC for a project. My jawboning won't change your mind, but experience might.


    Hear, hear!
  145. Concurrency models by zestyping · · Score: 1

    The E language has a very interesting and powerful approach to concurrency that avoids many of the trickiest problems with threads. Have a look at the paper Concurrency Among Strangers: Programming as Plan Coordination by Miller, Tribble, and Shapiro.

  146. Re:Sillyness aside, I can't find the licensing inf by Russellkhan · · Score: 1

    Not sure about the language itself, but there are interpreters with various licenses available including one on Sourceforge with unknown license: http://sourceforge.net/projects/openapl (feeling too lazy to make a link, sorry)

    BTW, J is the descendant of APL which doesn't require some kind of wacky keyboard to use. It's probably the one to look into if you are looking to pick up APL on a standard PC.

    --
    Information doesn't want to be anthropomorphized anymore.
  147. The difference between 1 & 2... by tlambert · · Score: 1

    The difference between 1 & 2 as you've posited them:

            1. Allocating objects on the interrupt handler's stack.
            2. Allocating objects in a zone that is reserved for the interrupt handler.

    is that in the second case you could suffer from zone exhaustion, and be unable to refill the zone at interrupt time. This may occur because there are no pages available, or because refilling the zone would block, or because the zone of zones is exhausted.

    If you could override the allocation with an alloca() to force it back onto the stack, then this would not be an issue; however, the general reason for using zones is to obtain type-stable memory.

    [Aside:]
    You do this to prevent someone else's double frees or use after free from shooting you in the foot: you are guaranteed that the damage will be scoped to the zone, and therefore limited to the object type in the zone. So as long as you are not talking about generic sized zones (i.e. zone allocators typically implement a set of "powers of two" zones for random, temporary allocations), then any problem you have can be located relatively easily, since it's scoped to a fairly small amount of code.
    [/Aside]

    I don't think, therefore, that it's really going to end up very useful to map a zone to an alloca() in the general case, since you might as well use stack declaration or alloca() directly; the exception to this would be object scoped languages (e.g. like the one we are discussing here), to permit abusing the override for a subclass of the object acting as the object type (this would probably be considered "bad form", from my reading about the language).

    Hope that clarifies what I said a bit...

    -- Terry

  148. Bounded time, malloc, new, using GC in a project.. by tlambert · · Score: 1

    Bounded time, malloc, new, using GC in a project..

    Actually, you can run a malloc or a new in bounded time; the issue is whether or not you have an allocator that's capable of doing it or not. If you preallocate objects to your zone, you can perform the operation in O(1) - the amount of time to take something off the free list - and you can do it without locking, so long as you utilize per-CPU pools for your object freelists. If you want to grab one and the freelist is empty, you can fail the operation and force it to retry later (or you can decide not to reenable interrupts until the top end has completed processing and returned the free work item to the interrupt handler one-item-pre-cache).

    My personal preference would be to preallocate as much as I will need to run the operation to completion - and no more. It's OK to have a data source that's noisy and generates a lot of work items, but only if it happens at soft interrupt.

    For things like network drivers, the delyed reenabling of interrupts is the best bet. First of all, you likely want to take one interrupt and poll like hell until there's no more data; an 8MHz PC can keep up with 115K baud serial data (barely) if you do that, whereas direct interrupt processing will cause it to lose it. Second, you don't want to reenable the interrupt to let it reinterrupt you if you can't drive the data all the way to the application anyway; reenabling the interrupts prematurely leads to problems like receiver livelock, which has been known about for years (google for "livelock" "networking" "DEC" "WRL" "Jeff Mogul").

    As far as using GC in a project, I've done it, and I've seen it done (Objective C supports GC in the next release of Mac OS X, as reported on Apple's web pages, so I'm not letting any cats out of any bags). My personal opinion is that once one framework you need becomes "GC-only", there will be no way to make code that correctly operates as both GC and non-GC code. The problem is that programmers are human, and they make mistakes, and if the mistake happens to be that you forget to release some memory, but it's OK because GC catches it, then you will never be able to go to a non-GC world and depend on that code again. For me, that means I can never take that code, or a part of it, and put it into an environment where GC isn't possible because I need to run in bounded time, without debugging it, or doing a full branch path analysis on it and generating test cases to exercise all the code paths; at that level of cost, I might as well just rewrite it from scratch.

    A real world example of this was the use of the TSM (Tivoli Storage Manager) Java edition on the Whistle/IBM InterJet (I worked at Whistle, which was acquired by IBM). The TSM had an insane memory footprint, and we never shipped it as a product. While the GC in the Kaffe JVM kept the footprint to about 1/3 of the memory that the Sun JVM's GC did at the time, that was still twice the amount of physical RAM we had budgeted for the box. This was all user space code, but driving up the COGS of a product by 11% on the off chance that we would be able to later sell a service add-on for TSM to a percentage of the people who bought the product on its own merits was just bad business.

    -- Terry

  149. Re:I have a problem with GC in a systems language. by be-fan · · Score: 1

    The non-determinism is orthogonal to GC versus malloc(). Neither of those mechanisms are deterministic. In order to write a time-critical handler in a GC'ed language, you do the same thing you do to write a time-critical handler in C: allocate from a fixed reserve pool of memory. Note that this should almost always be an applicable technique, for the simple reason that its rare to have a function with fixed time-bounds but variable space-bounds.

    Take something like an interrupt handler. In the Linux kernel, you can't sleep in a bottom-half. All the memory allocation primitives sleep by default, so you have to call kmalloc() with GFP_ATOMIC. GFP_ATOMIC services the request from a pool of reserved memory, and fails if that memory is exhausted. In a kernel written in a GC'ed language, you could do the same thing. Grab some objects from the GC at startup, and grab one of those objects in the trap handler instead of calling the GC and potentially invoking a collection.

    --
    A deep unwavering belief is a sure sign you're missing something...
  150. Re:Erm how is this better.. by ericthughes · · Score: 0

    Visual Basic 3

  151. Re:I have a problem with GC in a systems language. by be-fan · · Score: 1

    RAII only solves the resource management problem for a small class of resources: those with dynamic extent. However, many objects need to have indefinite extent. Consider a C compiler. RAII is appropriate for a file handle in a function that opens a file, reads in the source code, and immediately closes the file. However, its completely inappropriate for the nodes of the abstract syntax tree that it creates from that source code, and passes to the rest of the compiler.

    That's why C++ has smart pointers --- it handles the resource allocation problem for objects with indefinite extent (at a substantial cost in performance, btw). It's also why every non-trivial piece of C code has one (or more!) reference-counting mechanisms in place. In practice, GC is much simpler, and usually faster, than these ad-hoc mechanisms.

    --
    A deep unwavering belief is a sure sign you're missing something...
  152. Re:The feature-checklist school of software design by arevos · · Score: 1

    I agree with you in general. A lot of languages have complexity that they don't necessarily need. One of the pieces of syntax that really annoys me is the 'new' operator in Java and C#, but I digress.

    Whilst simplifying the formal structure of language is a good goal in general, I think that sometimes simplification can reduce ease of use. For instance, most languages use a combination of prefix and infix forms, whilst it would arguably make for a simpler grammar by just sticking to prefix notation. Similarly, some languages mark whitespace as significant (notably Python, but also languages like Haskell), which adds to readability (or at least, doesn't detract from it), whilst possibly being more difficult for a machine to parse.

    Or, to put it another way, simplify a language too far and you get Lisp, which can be rather homogeneous and difficult for a human to read. So some complexity in a language's grammar would seem to be beneficial. Too much complexity, though, and you get the problems you illustrate.

  153. Re:Erm how is this better.. by ZenShadow · · Score: 1

    You keep on believing that, bro. Me, I know better, and I prefer to live in reality rather than inventing my own ideal world. Even if you *could* manage to provide respectable sources indicating that Java is "gaining ground" at MySpace, I guarantee you beyond the shadow of a doubt that I can canonically prove you (and said sources) completely wrong.

    You can stand on your Java soapbox all you want, but claiming things that simply aren't true isn't going to help your case.

    Care to try to come up with some sources? I'm game for shooting them down. Hell, at least say what part of MySpace it is that you think is written in Java!

    --S (The thing I hate most about Java tends to be the closed-mindedness of the developers that come with it. Talk about drinking the kool-aid...)

    --
    -- sigs cause cancer.
  154. I hate D! by Tanuki64 · · Score: 1

    No, not the language. The features sound nice. But I really really hate the name. Same as 'C'. Why? Search for 'D' in Google (or anywhere else). 'C' was pre-internet and pre-search engines, so the name is excused, but today I'd make sure that any program I write or I am responsible for would have at least four letters.

    1. Re:I hate D! by ChrisNSauls · · Score: 1

      Originally the language was to be called Mars... but the name just didn't stick. Anyhow, try googling for the full phrase "The D Programming Language" and you'll have better luck. That particular phrase is the "canonical sugar" to be included somewhere in all sites/pages/resources pertaining to D. (Not that it always happens, alas.)

  155. Re:Sillyness aside, I can't find the licensing inf by streepje · · Score: 1

    What is the licensing for this language? I've found lots of copyright notices, but no licensing information. Huh? A license for a language? Think about it for a minute. What on earth would that be?
  156. embrace&extend by Anonymous Coward · · Score: 0

    The key success factor that D needs to succeed, is to have what c++ lacks: a multi-platform GUI library that comes as standard with the language.
    This way, D can move away from being a simple "language" (like c++) towards being a complete "platform" (like java/sharp). C++ comes with a good standard library, but that's it. D must come with a good standard library that also covers graphics! Just wrap any multiplatform GUI toolkit (like WXWindow) with D classes, and ship that with every D compiler.
    Of course, an IDE would also be needed to ensure success, but let's start with having a standard GUI library first.

    1. Re:embrace&extend by ChrisNSauls · · Score: 1

      But what if I need feature X of some other GUI library? Or what if I don't need the majority of the standard GUI library? Or maybe I need a GUI which supports forms/markup based interfaces? Or, or, or... Its better to have options, and choose the best tool for the job. (Just like with programming languages! ;)) That said, there are already some efforts under way. There are wrappers/bindings being written for existing libraries, such as DWT (SWT) and wxD (wxWindows). And there are written-in-D-for-D GUI libs such as DUIT, DFL, SDWF, and Harmonia.

  157. So... by TrixX · · Score: 1

    Congratulations for inventing Eiffel, 20 years later, without good MI.

    OK, the note above is a bit of a troll. But objectively, most of the interesting and cool features of D were in Eiffel (DbC, well implemented generics, garbage collection, fast); and I don't miss most of the features that D has "over" Eiffel (like static overloading instead of just dynamic one; I think static overloading is more a liability than an asset).

    However, if D catches on and gets a larger community than Eiffel (which implies more tools and libraries) I may seriously consider using it.

    1. Re:So... by Anonymous Coward · · Score: 0

      On the list of most popular languages at TRIOB http://www.tiobe.com/tpci.htm D is 14'th while Eiffel is a tie at 51. Ok triob is not the most accurate representation and doesn't include the years of lecacy code, however it does indicate that D is on the rise.

      PS - Well done Ruby, programming language of the year. Moved 11 places, wow.

  158. D version 1.0 has been released! by renoX · · Score: 1

    Not much else to add, ah yes: thanks Walter for building a *sane* language which may eventually replace C++ for many tasks..

  159. Re:The feature-checklist school of software design by Anonymous+Brave+Guy · · Score: 1

    I think we're in pretty close agreement (even on the digression about new :-)).

    In general, I tend to think that in practice, very uniform or punctuation-free languages actually become harder to read, just as those with too much clutter do. I also think the places you need punctuation differ depending on the programming style: a lot of functional programming languages don't use () in a mathematical way to denote function calls, for example, while it's common to do so in procedural languages.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  160. Re:Sillyness aside, I can't find the licensing inf by gmezero · · Score: 1

    Libraries, compilers, etc... You know like that fancy Microsoft compiler which has a license that specifically states you can't write software using their languages/compilers the competes with any of their own products. For instance, gems like this ... You cannot "distribute Distributable Code, other than code listed in OTHER-DIST.TXT files, to run on a platform other than the Windows platform" and "The software contains code that you are permitted to distribute in programs you develop if you comply with the terms below." ...oh don't get me started.

  161. P.S. by Anonymous Coward · · Score: 0

    I can't believe you don't know this

    Just because he didn't mention it, that doesn't meant that he doesn't "know this". Even if he doesn't, why is it so difficult for you to believe it that you find yourself incapable of doing so?

  162. Unicode does too much and too little by Joseph_Daniel_Zukige · · Score: 1

    They combined CJK but failed to combine Latin, Greek, and Cyrillic.

    Glyphs were originally intended to not combine, but of course that wasn't practical. Eventually they added a set of composition rules for the CJK radicals, and a set of radicals.

    Lots of tradeoffs where the first guess was wrong. But we needed the "univeral" character set sooner, rather than later.

  163. Re:The feature-checklist school of software design by Anonymous Coward · · Score: 0

    Speaking of Eclipse... how come it lacks a "compile this file" feature?