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

GoingNative 9: LINQ for C/C++, Native Rx, Meet Aaron Lahman

40 minutes, 37 seconds


Right click “Save as…”

LINQ is one of those modern technologies missing from the C++ toolbox. By extension, so is Rx (Reactive Extensions), which of course is LINQ at its core... Well, today we're happy to announce that this is no longer the case. Erik Meijer's team is delivering on their promise of a native Rx. It's not available for download yet, but the work is being done and great progress has been made! Rock and roll.

Aaron Lahman is the newest member of Erik Meijer's gang of stellar developers. Erik and team are cranking away at pushing LINQ everywhere. Here, we meet Aaron and geek out about C++ LINQ (it's a modern library... Aaron's not extending the language....) and RxC (that's C as in C (not C++)—why C? Why not RxC++? Does it really matter?...)

Here's a trivial example employing C++ LINQ:

vector<int> some_primes(size_t howMany)
       auto xs = from(int_range(0, INT_MAX))
       return xs.to_vector();
             // or: vector<int>(begin(xs), end(xs));

Table of Contents:

[00:00] GoingNative(); //Charles flies solo for this episode. Make sure you check out the sessions from Developing Windows 8 Metro style apps with C++ event. This is the only place to learn (deeply) about WRL and C++ + XAML + DX, for example. Herb Sutter's keynote is excellent, of course.

[03:00] Charles interviews software developer Aaron Lahman. Aaron explains (whiteboard and demo included) the work he's doing building a LINQ library for C++ and Reactive Extensions for C. Aaron is great at explaining what he's doing (and why he's doing it). Thank you, Aaron! Go Rx!!

[39:58] ~GoingNative();


Follow the discussion

  • Oops, something didn't work.

    Getting subscription
    Subscribe to this conversation
  • Now you're talkin'!  This sounds really interesting!


  • I have to watch the full video, but will this library be able to be used outside of Windows development?  It will be great to have to develop Windows apps, but would be insanely powerful for other types of software development.  Either way, keep up the great work.  I'll update this comment after watching the vid this weekend Smiley

  • Hey guys,

    Very excited to see this. I had been working on my own implementation (http://sourceforge.net/projects/qlang/?source=directory) and I'll be happy to have a correction of my work by a "stellar" developer Wink

  • felix9felix9 the cat that walked by itself

    Oh, heard about that almost 3 years ago IIRC ......

  • CharlesCharles Welcome Change

    @felix9: Did you watch this?

  • AnonymousAnonymous


  • You know about two years ago I got so disillusioned with Microsoft's attitude towards their native code stack and associated tool chain that I went and bought a MacBook, paid up to join the iOS developer program and well... have grown to respect Clang and UIKit etc. Then about a year ago, after a decade of managed code 'tyranny' Wink I find Microsoft is pouring more love into their native offering than I can member in almost 2 decades of programming with their C++ implementation. It's looking more and more like OS X might end up mostly being a glorified boot loader for Windows 8 and VS2012 for me Smiley

    Having LINQ and Rx onside is going to be damn useful when it comes to luring managed folks out of their comfort zone. A little surprised to see this coming from Erik's crew, thought he was all about the .NET - but I'm not complaining. This. rocks. More please. 

    I've love to see Microsoft provide a native code, Standard Library friendly, XML library that didn't take a dependency on System.Xml plumbing, WinRT and if possible the IE XML DLLs. In other words source code.

    Very pleased to see a new episode of Going Native, really hope you keep this going beyond the official launch of Visual Studio 2012 and Windows 8. You're going to have to hold down the 'Undo' key for a little while longer until at the very least we get some parity in library functionality.

  • Ivan CukicIvan Cukic

    Been doing something similar on top of Qt collections library. Not a LINQ-similar language, but rather implementing a common functional style paradigms on collections. And all that both with eager and lazy approaches, chosen via template parameters.

  • @Ivan Cukic: but that's not open for us to see in anyway ?

  • AuxonRichard.Hein Read it: ​http://bitc​oin.​org/bitcoin.​pdf

    Fantastic ... will watch later....

  • felix9felix9 the cat that walked by itself

    , Charles wrote

    @felix9: Did you watch this?

    Well, I had not yet when I wrote the comment above, and I have watched it now, why ?

    You said its been talked about in PDC10, but I thought someone had talked about a possible port of Rx to C++ in early 2010 or even 2009, could be false memory though. Tongue Out


  • CharlesCharles Welcome Change

    @felix9: You seemed sure it had been done (I misinterpreted your statement...). As mentioned in the preamble and beginning of the video, RxC was first discussed at PDC10 on C9 Live with Erik Meijer...


  • Oh boy! oh boy! oh boy! This makes me SOOOO happy!

    I have had LINQ envy for my C++ code so much that I had rolled my own C++ "LINQ" like code a couple years ago. But having something from MS is so much better.  Big Smile



  • Looking forward to this.  Hope MS follows the pro-standardization direction that Herb Sutter has been trying to set.

    @dot_tom: I agree - a standard, source-format, portable XML library is very much needed.  (And a JSON library, a TCP/IP library, and an HTTP library.  Likely all built on an async task/futures-based runtime.)

    Who knows?  If this keeps up, maybe I can switch from C# to C++ a few years sooner than I planned!  (I'm not going to get my hopes up just yet, though.)

  • CharlesCharles Welcome Change

    @Lars Kemmann: Casablanca, though not a standard (it's an incubation project at this point), is a move in the right direction re modern client-server (HTTP, REST, JSON, etc) libraries for C++. It also employs an Actor-based concurrency model.

    Have you checked it out? You mentioned JSON, HTTP... Worth a look-see. And some developer feedback, too Smiley



  • LennyLenny

    Did Microsoft change cmd so that it works like bash now?

  • freeflyfreefly

    I see some good things happening from the VisualC++ division. I am very very happy to see new libraries for VisualC++.
    If VisualC++ team can push more libraries out then I guess C++ from Microsoft is going in the right direction.

    I am VERY VERY HAPPY WITH THE NEW "VISUAL STUDIO C++ IDE"... I have to say that you guys did a very good job with the C++ IDE.

  • poss taridliposs taridli

    really nice :)

  • Did Microsoft change cmd so that it works like bash now?

    It think it's power shell.

    LINQ in C++ looks a lot like boost::range on steroids. This is very promising and I can't wait to try it. I am tired of wrting code with the STL algorithms which do not compose as nicely as LINQ and it is one of the things that I miss most when programming in C++ and not in C#.

    What I do not get though, is why using C for Rx. Is it because the library that was wrapped was in C or is this a general decision? I doubt that people programming in C are really interested in Rx and using Rx in C seems to be very complicated. Why not doing all this in C++?

    An Rx interface to the async stuff in WinRT might be an interesting showcase.


  • Very intrigued who the people they're working with are who are looking for C ... Devil

  • IndranilIndranil

    Looks really promising!

    But I've got to ask. The biggest things that the STL has that I miss in in Linq.Net are well defined complexity guarantees and exception guarantees.

    If I call Count on a pseudo container that wraps a random access container will it perform better than one based on a fwd container? And will it be able to make that optimisation at compile time?

  • Definitely something I'm looking forward to testing! In the meanwhile I'll give this a try:

  • Aaron StainbackAceHack AceHack

    This is great news!!!

  • This looks excellent! A couple of simple questions:

    1. Will the generated collections (ex. powers) work with rage-based for?

    2. Will the generated collections work with the function form of begin and end? ex. for (auto i = begin(powers); i != end(powers); i++)

    It seems that I'll need to to_vector() if I want to use those but just wanted to confirm.

  • I see the trivial example above mentions begin() and end() so the ans. to my Q #2 is probably Yes. cool.

  • DiryBoyDiryBoy Nothing is true, everything is permitted

    There was a bug in VS editor in 32:04, the collapse [-] sign was next to line 24 but should be next to line 18 or 19

  • @schroedl: Yes, function-form begin/end and the range-based for-loop are designed to automatically pick up anything that has begin/end members, so they should just work out of the box with this library. No idea why the example didn't use range-based for.


  • @rab36:

    Did Microsoft change cmd so that it works like bash now?

    Actually, that's just cmd.exe, with a custom prompt (try "prompt /?") and a few aliases (try "doskey /?"). It's just a muscle memory thing for me.


  • @Indranil:

    Looks really promising!

    But I've got to ask. The biggest things that the STL has that I miss in in Linq.Net are well defined complexity guarantees and exception guarantees.

    If I call Count on a pseudo container that wraps a random access container will it perform better than one based on a fwd container? And will it be able to make that optimisation at compile time?

    Good question! Complexity guarantees have always been a bit messy for lazy evaluation. I'm not offering an excuse for Linq to objects, just general information. Everything just creates a wrapper, and the behavior of that wrapper depends on what's inside it and so forth.

    For instance, consider "r = Range(1, n); r.SelectMany(x=>r.Take(1<<x)).Where(x=>x==1)" -- no Linq operator takes exponential time, but each element of this composition takes exponential steps to compute (1, 2, 4, 8, ...).

    That said, I'll do what I can to make sure that the performance characteristics are, at least, predictable.


    As for optimizations, I looking at how much we can preserve. Generally, aggregations are always O(N), but we can optimize special cases, such as zero-argument count. Filtering is amenable to bidirectional traversal only, as we need to skip an indeterminate number of elements.

  • JohnathonJohnathon

    When can we expect this to be available? This sounds extremely powerful, and fixing the issue with querying databases would be nice, though not required for something such as a code preview :)

  • AndrewAndrew

    Any update on this? VS2012 and .net 4.5 are available now, so has this been officially released?

  • DamienDamien

    Also interested on when this might be available?

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.