Tuesday, November 14, 2006

GWC: The Missing LINQ

I'm going to give a talk about LINQ this Friday.  I'm quite hyped on LINQ:  I know it shouldn't feel like it's the next best thing since sliced bread... but... well...  I haven't prepared the talk yet, but I want to give a strait, to-the-point example of a program which leverages linq successfully, and not talk too much about difficult concepts like the abstract ideas behind LINQ.  Know of any simple samples?

LINQ looks rather revolutionary from java-esque perspective.  Queries with all kinds of nested phrases, lazy evaluation, query translation for real DBMS's, query execution over in memory data, and more!  What's revolutionary isn't the features themselves though, but their embedding in a mainstream language - and by the looks of it, this will be an embedding eminently useable without intimate knowledge of its inner workings.  LINQ, first and foremost, is practical.

The roots of LINQ can clearly be found in functional languages such as LISP and Haskell.  Interpreting a syntactic expression - such as a LINQ query - as data which can be used to generate useful behavior in for instance a database, but might equally be interpreted as code to execute is something LISP macros are well known for.

LINQ does not transform C# into a functional language however:  Key functional language abstractions are missing or broken, and you'll find frustrating roadblocks, or unhandy syntax if you try to implement an entire program in functional style.  The missing expressive power isn't merely a disadvantage though as it makes difficult concepts such as monads unnecessary.  That kind of functionality is more easily implemented in C# as-is anyhow.

So what is LINQ?

LINQ takes an extremely important area - query - in which functional and declarative languages used to provide clearly better programming experience, and aims to simplify it by co-opting a bare minimum of functional features, wrapping those in delicious syntax sugar, and serving it warm :-).

At least, that's my view.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home