Coffeehouse Post

Single Post Permalink

View Thread: LINQ for JavaScript :)
  • User profile image
    esoteric

    JChung2006 wrote:
    

    I see LINQ to Objects as an application of the functional programming constructs added to C# 3 and VB 9, constructs which JavaScript already had.  LINQ to Objects' power and expressiveness come from those constructs, not from LINQ to Objects' application of them.  I like the new syntax, too, but the inconsistency of the syntax between C# and VB is a little annoying.

    The implementations of most of the Enumerable extension methods are fairly straightforward.

    Query is important, and LINQ to Objects is great. I love it! But, as we'll see with PLINQ and the TPL, the functional programming constructs that enabled LINQ to Objects are capable of much more than that.

    I don't see how Volta is relevant to your point.



    The point of Volta is this context is twofold

    1 - It is possible to use C#/VB/_
    2 - It is possible to use the special LINQ syntax(es)

    Some people don't see it, but yes, Javascript is a kind of dynamic functional programming language. The difference of course is that the "var" in Javascript is truly dynamic and cannot not be static whilst in C# it really is as static as possible - meaning as static as the right-hand-side reveals - so unless the value is cast to a less specific type, i.e. object, the left-hand-side type will be specialized to the max, so to speak.

    I think the combination of static safety, the LINQ to Objects and the LINQ syntax is key. Not that I don't like Javascript. I have done a lot with it but I hope the static languages get more dynamic features so we can get dynamic-when-needed and static-where-possible as a certain Meyer has more-or-less put it.

    Not sure where we disagree, except that you seem to like Javascript as is. And perhaps that I don't see how your distinction between the power of a construct and the power of its application as particularly meaningful.

    But the new constructs enable other things than LINQ as they should. They are part of a general purpose language after all. TPL does look like a very good mid-term solution to parallelism. Long-term, who knows.