News for hackers. Stuff that matters.
Re:TypeScript: a language for application-scale JavaScript d... by spicyj on Monday October 01, 2012 @01:47PM (#4598360)
Have you used the popular library Underscore.js http://underscorejs.org/? The equivalent to your code in Underscore would be:

    _.chain([1,2,3]).map(n => n * n).filter(n => n >= 2).value()
Re:TypeScript: a language for application-scale JavaScript d... by wingspan on Monday October 01, 2012 @02:00PM (#4598425)
I did look at underscore when figuring out how to design the library, along with many JS LINQ variants (http://ianobermiller.com/blog/2012/09/19/linq-for-javascript...).

It should be pretty straightforward to provide Underscore bindings for TypeScript.

One big difference in the library I was working on is that it is lazy, and modeled after .NETs IEnumerable. Whether this is a good thing or not, I'm not yet sure.

Re:TypeScript: a language for application-scale JavaScript d... by sciolistse on Monday October 01, 2012 @02:23PM (#4598546)
I've made a lazy linq-like library for javascript in the past..

The problem i had was that the native array methods are rather fast while function calls (for moveNext) are quite slow, so i couldn't get a whole lot of speed out of it.

Newer javascript engines might be sufficient to offset that though.

Re:TypeScript: a language for application-scale JavaScript d... by wingspan on Monday October 01, 2012 @02:27PM (#4598566)
I tried to get around this by creating overloads of almost all methods when you are operating on an array. `each` for instance, has a standard implementation using moveNext, and then an array implementation using a fast for loop. In some cases you could even drop down to native function calls.
Re:TypeScript: a language for application-scale JavaScript d... by sciolistse on Monday October 01, 2012 @02:45PM (#4598655)
Sounds reasonable. Could be better timing now as well, what with server-side javascript having become popular. Good luck with the library!
Re:TypeScript: a language for application-scale JavaScript d... by colin_jack on Monday October 01, 2012 @02:09PM (#4598476)
As a .NET and JS developer underscore is definitely the secret sauce that means I don't miss linq at all. Lovely lovely little library.