Linq 

for the JVM






Irving Cordova
irving@irvingc.com

What is linq?




"an innovation ... that bridges the gap between the world of objects and the world of data"
(Microsoft) 

The usual way



What's wrong?




  • No type checking

  • Errors are found at run time

  • Poor IDE support

The bridge



The Linq way


 "You write queries against strongly typed collections of objects by using language keywords and familiar operators"
(Microsoft)

Linq in the JVM?




 

Has been attempted...

but it has not been really successful.


"In order to get Linq-like method-chain syntax in Java that looks and works like what's in C#, you need two things Java doesn't support; extension methods (static methods that can be applied to an instance as if it were an instance method), and lambda expressions (anonymous delegates)".

extension methods 

in the JVM?


Why there is even a JVM language named around it :-)



ENTER Xtend



My project


Bring LinQ to the JVM using Xtend.


DEMO

The grammar

(just a segment)



currently implemented


  • Support for "iterables" (no support for SQL connections or other types)
  • Support for "select"
  • Support for "where"
  • Support for "min", "max", "average" selectors
  • Support for "single"

The Road Ahead




  • Stop losing type information

  • Integrate code to Xtend

  • Strong checking on the parameters inside the query

Questions?











Irving Cordova

Linq for the JVM

By Irving Cordova

Linq for the JVM

  • 1,165