Andrei Alexandrescu: Three Unlikely Successful Features of D

Download this episode

Download Video


Designing a programming language has a strong subjective component.

There are features - such as type and property inference - that many would agree are useful, subject to proper language integration. But then there are features of which utility is not immediately obvious, and that could go either way when it comes to community adoption and scaling up to real, large programs. This talk discusses three such features of D - seemingly unimportant, maybe greeted with a ho-hum by the community, but today ubiquitously used and enjoyed.









Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • User profile image

      Would the video be posted here?

    • User profile image

      It looks like they're being edited and posted in chronological order.

    • User profile image

      Videos will be posted in the order they get done... Smiley Stay tuned. Slides are live...


    • User profile image

      Martin Nowak found a bug in my generalized palindrome implementation, sigh. There are many possible fixes, his proposed one being among the simplest.

      The idea here is that if the range is left at exactly one element, it can't be reduced from both sides (one size suffices).

      bool palindrome(Range)(Range range) {
          for (; !range.empty; range.popFront(), range.empty || range.popBack()) {
              if (range.front != range.back)
                  return false;
          return true;

    • User profile image

      I think that the D features you presented just rocks Cool

      I have a question if you think that C++ based ScopeGuard or Boost.ScopeExit with std::uncaught_exception() usage can be the same robust as in D?

    • User profile image

      Some first naive implementation:

    • User profile image

      It should be mentioned that the error handling example of C++ is not inherent to the language and shouldn't be considered modern anymore. There is a superiour way to achieve automatic undo behavior in case of errors:
      scope guard + C++11 lambdas

      Now guess who invented former :)
      I'm a little curious why this didn't find a mention at all?

    • User profile image

      Okay, my question was answered at the end of the talk...

      "cannot detect exceptional return"
      Usually this is not a problem since there is only a single place where the "task is fully completed", that is where you place the "dismissed". All other code paths, e.g. exception, premature return, do not matter.

      > Some first naive implementation
      Why not use an elaborate one?
      Like Loki's:

      Or an C++11 optimized version:

    • User profile image

      Ha busted!

      Always thought you had to be from another planet, you blew it with that move at 11:55!

      Keep it up! Really starting to see the point for D, to me it has a bright future. If you can implement pattern matching you will rule the planet with this (after some libs are converted obviously).
      Wish I could use it here..

    • User profile image

      opening thread

    • User profile image

      I have implemented scope(failure) and scope(success) in C++.

      For example:

          int some_var=1;
          cout << "Case #1: stack unwinding" << endl;
              cout << "exit " << some_var << endl;
              cout << "failure " << some_var  << endl;
              cout << "success " << some_var  << endl;
          throw 1;
      } catch(int){}


    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.