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
JS driver - Change the syntax of run #1890
Comments
@neumino -- would you mind finding one or two other examples of how they do it in node land? If we make a change, we should make sure it's widely accepted. |
I think it's safe to do the change.
See http://nodejs.org/api/fs.html#fs_fs_readfile_filename_options_callback |
Ok, sold. |
Since this would break most existing code, maybe it should be a post-LTS thing? |
I actually believe you'll be better off breaking things now rather than later. People will get used to things the way they are and you will have more users to upset later on than now. |
|
I'd actually prefer to break code here. Having two distinct ways to call a function is pragmatic but has a bad smell to me. I think we should move to what the rest of the world is doing, and then tell people to change the code. It's a simple enough change that it's worth to just do it IMO. |
We should at least add special error logic to detect when people are using the old syntax and tell them that we changed it. |
👍 |
@mlucy -- also, you're really a fan of the "did you mean?" approach, aren't you :-D |
Ok, I can update the driver and make it backward compatible. In case people use the old syntax, I'll just print a warning. I saw a few libraries doing it. |
I'd prefer to error on old syntax and print a clear error message. I really don't like the idea of having two different ways to do something as simple as create a connection. Having one way is just better. |
Up in review 1243 assigned to @AtnNn |
The behavior is to log a message in case the user uses the old interface. The new syntax being |
What message gets printed? Where does it get logged? |
The current is: And it's logged with |
I think it is better to not show any warning and to mention that the old behaviour is deprecated in the documentation and in the release announcement. If you really want to show it warning, ideally:
|
That's ok for me. I just removed the warning. |
Err, I don't think silently supporting an old, misguided function signature is a good idea. At the very least we should change the signature in the docs, and have the old signature in a deprecated example. I think we have different people with different philosophies on compatibility, and it's hurting us because there is no coherent approach throughout the whole product. We need to make a decision on #1960 and stick to it everywhere. I don't think we should do this before the release, but it's really important for all of us to commit to a single approach. Let's talk about it together once 1.12 is out. |
(To clarify, I don't think we should delay shipping this issue, just that we should commit to a compatibility approach after 1.12 and follow it strictly after that) |
On second though, we should keep the message logged because if a previous user write new code, he must be aware that he's using a depreciated syntax.
We shouldn't let people disable it. If they have to update their code with |
I agree with @coffeemug that we should ship this and argue after, but I think we shouldn't support a deprecated syntax here. We should throw a descriptive error describing the new syntax instead. |
Note that
|
What do you mean by "print it only once"? Is it once per process invocation? How does that work? |
If you run two queries using the old syntax for If you kill node and restart your script, the message will be printed again (but once per "session") |
Ah, got it, thanks. |
Merged in next as 45843c7 |
@neumino @coffeemug @AtnNn I understand the need for this change, but now I am confronted with the question of whether my library (reheat) can support 1.11.x and 1.12.x. Reheat currently depends on 1.11.0-4. Can I safely change to 1.12.0-0? Should I try to support anything other than the current version of RethinkDB? What is the compatibility between new servers and old drivers, and old servers and new drivers? Is there a detailed changelog anywhere that lists breaking changes like the one in this issue? In my testing of the
If it works, my ideal solution would be to have reheat depend on the 1.12.0-0 driver. The last two lines in the table above seem to indicate that I can upgrade safely. |
Hello @jmdobry First, we are sorry for all the inconvenience the changes we made can produce. We are also aware that this involves some work for people maintaining libraries like reheat. We really appreciate your work, and will try our best to stop making breaking changes as soon as possible. To answer your questions, the changes for the syntax of If you run into a bug/crash, feel free to open a GitHub issue, and I'll make sure to fix it -- but as far as I have tested it, the 1.12 driver works with the 1.11 and 1.12 server (like your tests show too). If you have more questions, let me know. |
@neumino Thanks. I'll upgrade then. |
Hey guys,
Above fails with Driver version is |
This works fine for me with the driver My guess is that |
Here is how I defined
|
Can you try to print |
Result of log
You can check out https://gist.github.com/dulichan/542059c00a99b7a5a999 for the whole code. |
See https://gist.github.com/dulichan/542059c00a99b7a5a999#comment-1314935 The function of the second You can bind the connection to this like in the comment. |
Oh - I thought Thanks @neumino |
@dulichan -- I think there's a misunderstanding.
So you can call |
Got it. I forgot that rule of the promise. Thanks @neumino |
run
uses a really strange syntax when the user wants to pass some options.The two syntaxes are
The second syntax should be
See second example in http://docs.nodejitsu.com/articles/javascript-conventions/how-to-create-default-parameters-for-functions
The text was updated successfully, but these errors were encountered: