rethinkdb icon indicating copy to clipboard operation
rethinkdb copied to clipboard

Support of Dart 2.0.0

Open alexd1971 opened this issue 6 years ago • 18 comments

Are you going to upgrade to Dart 2.0.0 support?

alexd1971 avatar Sep 06 '18 11:09 alexd1971

Sure! I think the changes will be minimal so it shouldn't take too long.

billysometimes avatar Sep 07 '18 23:09 billysometimes

Actually I guess this is more complicated than I had previously thought. Dart 2.0.0 has greatly changed the way noSuchMethod works. Previously we could abuse it to allow for varargs, for example getAll we could do any of the following: r.getAll('moe', {'index': 'first_name'}) r.getAll('moe', 'larry, {'index': 'first_name'}) r.getAll('moe', 'larry, 'curly', {'index': 'first_name'})

Only the first example matched the method signature, the next two would be invoked through noSuchMethod. It seems that with dart 2.0, we can no longer do this.

I could still update the driver, but when writing with dart 2.0 you would not be able to follow the API, you'd have to rely on the args method a great deal in order to make the every method match it's signature:

r.getAll(r.args(['moe', 'larry, 'curly']), {'index': 'first_name'}) r.branch(hour > 12, 'Good morning', r.args([hour < 17, 'Good afternoon', 'Good evening']))

I think this really hurts readability, but I am open to suggestions and discussion.

billysometimes avatar Sep 08 '18 23:09 billysometimes

@billysometimes, Could you make a branch with 2.0 version?

pafik13 avatar Sep 12 '18 14:09 pafik13

@billysometimes, Thank you for the branch. I try to connect and get "Server dropped connection with message: Wrong password" everytime. I tested it with default server configuration. If I use 1.24.3 sdk I haven't connection problems. What am I doing wrong?

pafik13 avatar Sep 16 '18 10:09 pafik13

I found that new PBDKF package working wrong. I update old package and make PR here

pafik13 avatar Sep 16 '18 13:09 pafik13

LMK if you need any help rolling this... Without Dart 2 support, I can't update package:angel_rethink, so I'm more than willing to send a PR.

thosakwe avatar Nov 03 '18 00:11 thosakwe

Ping

thosakwe avatar Nov 07 '18 13:11 thosakwe

Sorry about the delay. @pafik13 submitted a PR to fix the PBKDF2 package, but they haven't published a new package to pub (https://pub.dartlang.org/packages/pbkdf2).

I have updated the dart-2.0 branch to pull the package from github, so you could change your dependencies to:

  rethinkdb_driver:
    git:
      url: git://github.com/billysometimes/rethinkdb.git
      ref: dart-2.0

but quite honestly I don't know if we should publish a 2.0 compatible package until we figure out what a Rethinkdb Query with varargs should look like in a language that does not have varargs.

I'd also like to find out why the more up-to-date package:password_hash PBKDF2 utils seem incompatible with this driver.

And lastly I'm not certain it's worth updating a driver for a dead database written in a mostly dead language.

billysometimes avatar Nov 10 '18 23:11 billysometimes

  1. I see what you mean about them not having uploaded a new PBKDF2 package... I’ll try to email them.
  2. Dart is far from dead - if anything, it’s more alive than ever.
  3. If you are ever looking for another maintainer, or just contributions in general, I’m more than happy to do it. I guess it being “worth it” is a value judgment. To me, updating it is worth it, so whatever assistance you need, I’ll provide. On Sat, Nov 10, 2018 at 6:51 PM billy [email protected] wrote:

Sorry about the delay. @pafik13 https://github.com/pafik13 submitted a PR to fix the PBKDF2 package, but they haven't published a new package to pub (https://pub.dartlang.org/packages/pbkdf2).

I have updated the dart-2.0 branch to pull the package from github, so you could change your dependencies to:

rethinkdb_driver: git: url: git://github.com/billysometimes/rethinkdb.git ref: dart-2.0

but quite honestly I don't know if we should publish a 2.0 compatible package until we figure out what a Rethinkdb Query with varargs should look like in a language that does not have varargs.

I'd also like to find out why the more up-to-date package:password_hash PBKDF2 utils seem incompatible with this driver.

And lastly I'm not certain it's worth updating a driver for a dead database written in a mostly dead language.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/billysometimes/rethinkdb/issues/63#issuecomment-437631203, or mute the thread https://github.com/notifications/unsubscribe-auth/AJiKPF98ahg8gbS8M8Ef1W2-ZSOssq3Tks5ut2adgaJpZM4WcvAW .

thosakwe avatar Nov 11 '18 00:11 thosakwe

flutter+rethink may be a great combo

ghost avatar Nov 21 '18 03:11 ghost

Hello, I really liked the driver idea and would like to help in your migration to Dart 2.1, to be possible, I would like to start an immigration with you, I wanted to see this driver running on the aqueduct and on Flutter itself.

rullyalves avatar Nov 23 '18 22:11 rullyalves

@rullyalves Angel framework has top-notch support for RethinkDB - that’s why I want to update this library.

thosakwe avatar Nov 23 '18 23:11 thosakwe

Hi @billysometimes! I implemented some of the fixes in the varargs. Could you check them? I'll try to implement the rest.

marceloneppel avatar Nov 26 '18 16:11 marceloneppel

There are still some calls to dart:mirrors that prevent the use of the library on Flutter. I'll try to fix this.

marceloneppel avatar Nov 27 '18 00:11 marceloneppel

Thanks @billysometimes! I now have push access. @katutz Stay tuned, within the next few days, I'll work with you to land these changes and update this library for Dart 2.

thosakwe avatar Nov 28 '18 03:11 thosakwe

Anyone here knows if using the #foo directive would impact some type of minification on dart2js or in other dart environment?

@override
dynamic noSuchMethod(Invocation invocation) {
  return invocation.memberName == #foo
      ? Function.apply(
          baz, invocation.positionalArguments, invocation.namedArguments)
      : super.noSuchMethod(invocation);
}

If no, maybe we could simplify some parts of the code that I commited. Reference link: https://www.dartlang.org/articles/language/emulating-functions

marceloneppel avatar Nov 28 '18 10:11 marceloneppel

I added a pull request about the ClosureMirror removal. It is useful to make the driver works with Flutter. There is another mirror use, InstanceMirror, which can be removed with the lasts varargs fix, that still needs to be implemented.

marceloneppel avatar Nov 30 '18 17:11 marceloneppel

Any updates about my last PR, @billysometimes and @thosakwe?

marceloneppel avatar Dec 22 '18 17:12 marceloneppel