Loading user information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading user information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Andrei Alexandrescu: Three Unlikely Successful Features of D

49 minutes, 30 seconds


Right click “Save as…”


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.

  • Tag:

Follow the discussion

  • Oops, something didn't work.

    Getting subscription
    Subscribe to this conversation
  • chethanchethan

    Would the video be posted here?

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

  • CharlesCharles Welcome Change

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


  • Andrei Alexandrescuandrei_alex​andrescu Andrei Alexandrescu

    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;

  • 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?

  • Some first naive implementation:


  • ZenJuZenJu

    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?

  • ZenJuZenJu

    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:

  • GertJanGertJan

    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..

  • Golnazgolnazal HEY HEY HEY

    opening thread

  • I have implemented scope(failure) and scope(success) in C++. https://github.com/panaseleus/stack_unwinding

    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){}


Remove this comment

Remove this thread


Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.