A conversation with Anders Hejlsberg about the May 06 preview of LINQ

The new preview of LINQ went live yesterday. For this week's Friday podcast I got together with Anders Hejlsberg to talk about the project in general, and what's in the new preview.

Last fall, when I posted an example based on the first LINQ preview, Sam Ruby showed how to do the same things in Ruby. When I mentioned LINQ the other day, Mike Pence recalled Sam's demo and wrote to say:

The unification of code and data is at least as old as, well, Lisp. And back when you previously talked about Linq, Sam Ruby showed how what Anders and Co. were doing is really nothing new and is easily done in the programming language Ruby.

So, why perpetuate the myth that there is something new going on here? Congratulations to Microsoft for discovering dynamic language features, I guess, but why is this news?

I relayed that comment to Anders Hejlsberg, and here is his reply:

Regarding the question from your reader, I'm certainly not claiming that data/query integration in a programming language is new. Just look at dBASE or FoxPro or any one of a myriad other examples. However, I do think the unified programming model for query and transformation of objects, relational, and XML is new, as do I think it is new for a mainstream programming platform to have first class support for these concepts in the same way that objects and classes are first class.

There is no doubt you could take LINQ queries against XML and write them in XQuery (or perhaps Ruby, as Sam did); or take LINQ queries against relational data and write them in SQL.

But where else can you write cross-domain queries (e.g. a join of relational data and in-memory objects producing hierarchical XML output) of the nature I showed you on Monday?

In a query language that is as expressive as SQL or XQuery?

And in those queries make use of a rich framework like .NET?

With an architecture for pluggable query processors and dynamic queries?

And do so in an integrated toolset like VS that supports productivity features like IntelliSense, statement completion, and code refactoring (ok, some of these are still work in progress)?

Even if the overall idea is not new, I do think the way we've implemented it is both new and innovative.

Regarding "Congratulations to Microsoft for discovering dynamic language features", I think dynamic vs. static typing is entirely orthogonal to language integrated query. There are pros and cons to both. I actually think the ideal is somewhere in between. An interesting example is the advances we've made in type inferencing in C# 3.0. This is kind of a "have your cake and eat it too" situation. You get to write programs in the dynamic language style (without explicitly declaring and mentioning types) yet your programs are still strongly typed, such that they can be compile-time type checked and take advantage of tools like IntelliSense, statement completion, and code refactoring.

I'm not certain myself how much of LINQ is genuinely new, and how much is a creative synthesis of pre-existing ideas, but I do know that I'm fascinated by what it can do and where it might go. Its reach will ultimately be determined by the extent to which non-Microsoft databases of all flavors -- relational, object, XML -- are willing and able to plug into the LINQ framework. To that end, one of the most significant points in today's interiew is the announcement of IQueryable, an interface that formalizes how providers plug into LINQ. Watching the uptake of this mechanism by third parties over the next year or so will tell us a lot about whether LINQ will be a Microsoft-only phenomenon or something that more broadly influences the industry.

Update: Transcript now available.

Former URL: http://weblog.infoworld.com/udell/2006/05/12.html#a1448