-
-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Operator Overload .getField("abc") with Expr["abc"] #9
Comments
I think ReqlExpr is the right place to define them, that's basically what On Tue, Nov 3, 2015, 09:38 Brian Chavez notifications@github.com wrote:
|
Just finished operator overloading .. it's crazy insane:
AND IT WORKS! 💥 Thanks again Josh for all the help! :) |
In Josh's talk about the Java driver, there's a mention that Java doesn't support operator overloading. https://www.youtube.com/watch?v=emjzNpKoNkM#t=16m53s
C# can support method overloading, seems like there's a lot we can do here with C#'s method overloads.
Some inspection on the Python driver:
Looks like a whole new area we can improve on... we should be able to pull off a lot of operator overloads for C#. This is pretty cool.
In particular, with
getField
, the query in Josh's talk:python:
some_object["field"]["subfield"]
JavaScript:
someObject("field")("subfield")
java:
someObject.getField("field").getField("subfield")
and in C# it may be possible do this type of query:
C#:
r.db("mydb").table("users").get("id")["field"]["subfield"]
Looks legit.
My questions would be:
_1. What is the mapping between Python's
class RqlQuery
and Java's AST?ReqlExpr
orReqlAst
?ReqlExpr
orReqlAst
. My gut feeling here, operator overloads would go intoReqlExpr
. Terms likeDb
inherit fromReqlAst
, and doesn't make sense for operator overloads to live inReqlAst
super class because operator overloads would be available on theDb
term.ReqlExpr
seems like the best place._2. In particular with
.getField
, is there a strict subset of terms that can have.getField()
called on? With.optArg
there was a distinction between terms with and without.optArg()
calls. I'm just wondering if the same could be true with.getField()
if Java supported operator overloading.@deontologician
Thanks for your insight 👍
The text was updated successfully, but these errors were encountered: