Chuck wrote:Regarding getting LINQ and friends to run on the JVM platform, I think that is doable simply by following Microsoft's design and implementing it.
There seems to be a "port" of LINQ of Java:
http://quaere.codehaus.org/Of course it is a modified version of LINQ adapted to the syntax of Java. For example:
Iterable<Integer> lowNumbers=
from("n").in(numbers).
where(lt("n",5).
select("n");
Maybe Cobra's JVM backed could take "pure" LINQ and translate it to Quaere's Java code. Under this approach, the code above would be generated by the Cobra compiler when the user writes "from n in numbers where n > 5 select n".
My main concern is having to implement N versions of LINQ if there are N backends (other than .NET) to be supported. To avoid this problem, a thin backend-specific abstraction layer could be defined, and a pure Cobra LINQ implementation, built on top of that layer, would be shared among all backends. Sounds like a lot of coding fun!
As for simulating delegates in Java, there seems to be some work already done:
http://www.onjava.com/pub/a/onjava/2003 ... gates.htmlThe proposed solution is not statically typed, but that shouldn't be a problem since all the Java code will be generated by the Cobra compiler, which will make sure that the types match.