Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I love the elegance of ReQL and how well it works in dynamic languages, but I still can't figure out a good way to port that lambda syntax used in python into the Java driver.


What about lambda expressions in Java 8? I haven't programmed in Java in years, so unless there are limitations I'm not aware of, they seem like a great fit.

Without those, doing an elegant driver would be pretty hard, which unfortunately probably means we'll never get good ReQL support into legacy Java.


So the way all underlieing communication is done is through a protobuf. So in python I know they hijack the expression and they can then construct the protobuf from the passed in python lambda. In Java land we can't really do that since lambdas are desugared at compile time to just be functions. In Java I can't even overload operators like you can in Scala or C++ to make it a little nicer. The result is your pretty much left with rolling the protobuf by hand.


Ah, got it!

The upcoming 1.13 release will introduce a pure JSON interface for queries (which official drivers will switch to). You'll be able to construct JSON directly, and send it to the server -- no protobufs. Would that make things easier?


FWIW, I think this will make it much easier to implement drivers. Getting protobufs to work is a real pain.


It will make it on par with the interface for other document oriented databases. I think it will be a lot more user friendly then the protobuf, and it might be the best that Java can do.


Sounds like that would work well - it's the approach ElasticSearch has taken with their APIs and they're generally very nice to use.


To clarify, in 1.13 JSON will be a communication protocol for queries. It's not intended to be used by the end user, but by the client drivers. You can use it as an end user, but it isn't nearly as nice as native language drivers.

The change is meant to simplify driver development, packaging, and improve performance. Protobuf is worse than JSON in almost all of these categories.


Take a look at this work by jooq:

http://blog.jooq.org/2014/03/21/java-8-friday-java-8-will-re...

You may be able to utilize a lot of their code for converting the lambda bytecode.. or not. Anyway it's interesting to see how they're dealing with the problem you've run into.


Well that looks promising. I will need to make a JDK8 branch to integrate this.


I could provide some assistance, I've did the scala driver and was making it work with java . When I get some time I'll submit a pull request.


I was about to abandon my Java driver for your Scala driver at one point. Scala is just a better language in so many regards.


I feel your pain, If I had to do it all in java I would of cried to no end.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: