In other words, LINQ should have been a library, not a language feature. (In my ideal world. It is possible that someone with better info could see such a move as a terrible mistake.)
In other words, LINQ should have been a library, not a language feature. (In my ideal world. It is possible that someone with better info could see such a move as a terrible mistake.)
I do agree though that LINQ seems to hint at and start evolving C# into a different semi-functional kind of language, and what we're stuck now with is a language with one foot in both worlds. Hopeful another language will come along one day and chisel out those ideas into a more pure form. (and I'm not meaning a pure functional language like for instance F#)
There is obviously a relationship between code like
.Select(blah).From(blah).Where(blah)
and SELECT blah FROM blah WHERE blah,
and I think it would be worthwhile to look into a language feature that allowed a reliable translation between these kinds of things. Maybe I want to write LET a = blah IN blah
from .Let(a, blah).In(blah)
or some such thing. It it just syntactical sugar? Is it a pattern that can be abstracted well?Most of the features that came along around the time of LINQ (var variables, extension methods, anonymous classes, lambdas etc) was done specifically to support the LINQ kinda syntax but LINQ in itself is not so much part of the language as it is of the .net libraries.
Btw, I personally think the "dot notation" syntax is superior to the "query expression". It's easy to follow from start of the line to the end and you get great autocompletion along the way.
No, that's flat-out wrong. LINQ's main feature is turning code into data: Put code in, get an expression tree out.
I suppose it is possible to build expressions with just libraries, but that would be very ugly (like control flow in XML) :)