Started to learn LINQ with C#.
Especially LINQ to Objects and LINQ to XML.
I really enjoy the power of LINQ.
I learned that there is something called JLINQ a JavaScript implementation.
Also (as Catbert posted) Scala will have LINQ
Do you know if LINQ or something similar will be a part of Java 7?
Update: Interesting post from 2008 - LINQ for Java tool
Look at Scala, which is powerful functional programming language, but is similar to Java and runs on Java platform.
In Scala it is possible to use essentially the same code constructs as in LINQ, albeit without special query comprehensions syntax present in C# or VB.
EDIT :
Here's an example of Scala's querying capabilities :
// Get all StackOverflow users with more than 20,000 reputation points.
val topUsers = for{
u <- users
if u.reputation > 20000
} yield u;
println ("Users with more than 20,000 reputation:")
for (u <- topUsers) {
println u.name
}
It's important to note that LINQ are four things:
People who just have heard of it may think of it simply as database integration. People who have worked a little with it probably think of SQL-like syntax. Those who really dug in will be aware of the monadic comprehension aspect of it, even if they don't know it for what it is.
If one takes Scala, for example, it has monadic comprehension without the other three. There is a library called ScalaQuery which provides database integration through the monadic comprehension (the intrinsic ability to do so being the main reason monads are cool). Another project, called ScalaQL, I think, intends to provide pretty much the same thing, but using a compiler plugin to enhance it. I wasn't aware of Miguel Garcia's work you mentioned, but, having seen other stuff he has accomplished, I'm thrilled by it.
One doesn't need special syntax to do monadic comprehension, however. It just makes it uncluttered by boilerplate. So that aspect of it is instantly available to languages with the right level of generics support.
Two things Scala doesn't do. The first is SQL-like syntax. That much can't be helped: SQL syntax looks out of place in Scala. I think it's safe to say most Scala programmers would prefer to stay with what is familiar to them -- the so-called for comprehensions.
The other thing is the one I haven't discussed yet, AST manipulation. That is the ability to manipulate code that has been parsed by the compiler, but not yet transformed in byte code, granting the ability to alter it before the generation is completed.
I think such a thing would be a boon to Scala -- heck, to any language. But, then again, I have a background as a Forth programmer, where the ability to alter code as it was being compiled was a God-given right. .Net can do it through LINQ, and so can some other languages, such as Ruby.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With