Skip to content
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

Make all and any in the Python driver behave identically to .and_ and .or_. #2659

Closed
mlucy opened this issue Jul 4, 2014 · 12 comments
Closed
Assignees
Milestone

Comments

@mlucy
Copy link
Member

mlucy commented Jul 4, 2014

See rethinkdb/docs#19 (comment)

@mlucy mlucy added this to the 1.14-polish milestone Jul 4, 2014
@Tryneus
Copy link
Member

Tryneus commented Jul 30, 2014

Fix is up in review 1839.

@AtnNn
Copy link
Member

AtnNn commented Jul 30, 2014

all and any are terrible names to use infix. Unlike the Ruby driver, the Python driver defines prefix functions and infix methods separately. I believe this is an advantage in this case. I don't think a.all(b) should be valid.

@Tryneus
Copy link
Member

Tryneus commented Jul 30, 2014

Currently there is no consistent syntax across the JS, Ruby, and Python drivers for these operations, e.g.:

  • Python provides r.all, r.and_, Term.and_, as well as the operator &
  • Ruby provides r.all, r.and, Term.all, Term.and, as well as the operator &
  • JS provides r.and, Term.and

Allowing for r.any and Term.any in all languages should be sufficient for all use cases while allowing for a consistent syntax across languages.

@AtnNn
Copy link
Member

AtnNn commented Jul 30, 2014

If the goal is to have a consistent syntax available across all drivers, we could use prefix r.all and r.any, or infix and and or, with an extra underscore in python. I don't believe it justifies supporting infix all and any.

@Tryneus
Copy link
Member

Tryneus commented Jul 30, 2014

The underscore means it is not consistent, and it hurts discoverability.

@mlucy
Copy link
Member Author

mlucy commented Jul 30, 2014

I think infix all and any are ugly, but that it isn't a huge deal. We don't have them in the docs any more, so the only people who will run into this are people who are translating old code from one language to another or something, in which case they know what it does and it seems slightly better to be consistent between languages to save them work.

@AtnNn
Copy link
Member

AtnNn commented Jul 30, 2014

it isn't a huge deal

This is where we disagree. ReQL being beautiful is very important.

@mlucy
Copy link
Member Author

mlucy commented Jul 30, 2014

From the perspective of a new user, all and any don't affect ReQL's beauty because they won't encounter them (they aren't in the API docs). The only people affected by this decision are old users who are using all and any in their code and want to translate that code to a new language for some reason. From the perspective of those people, having the commands be as consistent as possible across languages is the most beautiful option, because it reduces the number of sharp edges they'll bump into while translating their code.

@AtnNn
Copy link
Member

AtnNn commented Jul 30, 2014

Then we should deprecate infix all and any from the ruby driver.

@mlucy
Copy link
Member Author

mlucy commented Jul 30, 2014

I would be amenable to deprecating all and any altogether at some point. It would be mildly annoying for people, but it's better not to have undocumented terms supported indefinitely (and it will make it easier for new users working on older ReQL codebases).

@mlucy
Copy link
Member Author

mlucy commented Jul 30, 2014

But I don't think we should do that right now.

@Tryneus
Copy link
Member

Tryneus commented Aug 8, 2014

This has been approved and merged into next in commit 7604d74. Will be in release 1.14.

@Tryneus Tryneus closed this as completed Aug 8, 2014
@AtnNn AtnNn modified the milestones: 1.14-polish, 1.14 Aug 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants