Home
Feedback
FAQ
Getting Started
Discussions
Site operation discussions
Recent Posts
(new topic)
Departments
Courses
Research Papers
Design Docs
Quotations
Genealogical Diagrams
Archives
The first annual D Programming Language Conference is being held in Seattle this week.
You can get a taste by following the live blogging here.
Make writing generic code easier Improve robustness and auditability of code Add support for more programming paradigms Facilitate large-scale development Lay groundwork for supporting parallel programming
While this language is undoubtly C++-inspired, it can't really be considered a successor since it dropped the very good thing of C++: value-based programming. Simply because it adopted full reference semantics, which have a number of issues (shared ownership -- which was solved with GC, which introduces its own issues --, side effects, and of course concurrency hazards).
Even RAII, one of the other good points of C++ which is still available in D, becomes annoying -- because variables need to be declared as 'scope' variables -- if not dangerous to use. RAII is better with value-based programming, because copying the variable means copying the resource, rather than just aliasing it (and causing dangling pointers).
I think it doesn't make much sense to call it a "successor" since C++ is still evolving as well.
What about C++0x? I'd say C++ is still evolving..
Thanks for the links, I'm eagerly awaiting the macro feature: the current enum in D is quite underpowered (no easy way to print the enum label instead of its value in logs), but current trials to fix this with mixin are too ugly to be useful..
D's closures are broken.
The environment of a nested function points to the outer function's stack and continues to do so after the outer function has returned. When a dynamic closure is called, its vars may refer to a now defunct part of the stack (or worse, belonging to some other call). Horrors.
Unfortunately, it isn't merely a problem with the implementation; it is explicitly mentioned in the language reference.
I like many of the language's features. However, looking at the slides, I can't escape the feeling that this is another Groovy-style language kitchen sink in the making.
Is a reson for this design choice given, or is this simply an error that worked its way into the specification?
No, there are no reasons given.
I have the utmost respect for Walter Bright. I suspect, however, that the essential mindset behind the requirements and design is that one shouldn't lose any performance ground to C/C++, and it would be undesirable to go to the heap to allocate a closure.
All speculations, of course. The D folks have run into this problem already and it may be fixed.
Thanks for the info.
Full closures for D -- "D 2.007 brings full closures to D. I was tired of D being denigrated for not having 'real' closures."
Hmm, maybe you tipped the balance, Sriram? :)
Implementation notes here.
Walter Bright has mentioned that the reason is indeed to avoid heap allocation. Closures (as delegates) are stack allocated, very fast. There have been discussions to get proper closures without losing the option for stack allocation, through escape analysis or some sort of explicit syntax. I doubt this is a high priority atm though.
Recent comments
4 weeks 2 days ago
4 weeks 2 days ago
4 weeks 4 days ago
4 weeks 4 days ago
5 weeks 2 days ago
5 weeks 2 days ago
5 weeks 2 days ago
8 weeks 2 days ago
9 weeks 1 day ago
9 weeks 1 day ago