You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Kinrany (via GitHub)" <gi...@apache.org> on 2023/03/15 02:17:38 UTC

[GitHub] [arrow-rs] Kinrany opened a new pull request, #3866: Impl ObjectStore for trait object

Kinrany opened a new pull request, #3866:
URL: https://github.com/apache/arrow-rs/pull/3866

   This PR implements `object_store::ObjectStore` for trait objects:
   
   ```rust
   impl ObjectStore for Box<dyn ObjectStore> { ... }
   ```
   
   Every method calls the corresponding method of the inner dyn object.
   
   Closes #3865 
   
   # Implementation notes
    
   Ideally this impl would be generated by a macro, but I couldn't find a library to do this.
   
   In the future, it might be a good idea to somehow enforce that all default methods are implemented. Otherwise if someone implements `ObjectStore` for their own type, including a default method not covered by this PR's impl, then they will be surprised to find out that `box.foo()` and `(*box).foo()` are behaving differently.
   
   I haven't added any tests. This change is fairly generic, so I'm not sure if there's a good way to test it. Perhaps there is a property testing library that can generate not only different values of a single type but values of different types that all implement the same trait.
   
   # User-facing changes
   
   I don't think this will cause any breaking changes. No one but the crate itself can add this implementation, and it shouldn't conflict with anything.
   
   The ability to use trait objects for generic variables bound by `ObjectStore` is the only change I expect.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-rs] Kinrany commented on pull request #3866: Impl ObjectStore for trait object

Posted by "Kinrany (via GitHub)" <gi...@apache.org>.
Kinrany commented on PR #3866:
URL: https://github.com/apache/arrow-rs/pull/3866#issuecomment-1477727657

   🎉 
   Want me to add the impl for Arc too? It'd be easy, but I don't really have an opinion on the best design here because I haven't felt the need for it yet.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-rs] tustvold commented on pull request #3866: Impl ObjectStore for trait object

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on PR #3866:
URL: https://github.com/apache/arrow-rs/pull/3866#issuecomment-1477956488

   > Want me to add the impl for Arc too
   
   Sure, perhaps we can use a macro to reduce the duplication


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-rs] Kinrany commented on pull request #3866: Impl ObjectStore for trait object

Posted by "Kinrany (via GitHub)" <gi...@apache.org>.
Kinrany commented on PR #3866:
URL: https://github.com/apache/arrow-rs/pull/3866#issuecomment-1482305990

   A blanket impl for Deref is not possible because it could conflict with impls from other crates, on the other hand.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-rs] tustvold merged pull request #3866: Impl ObjectStore for trait object

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold merged PR #3866:
URL: https://github.com/apache/arrow-rs/pull/3866


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-rs] Kinrany commented on pull request #3866: Impl ObjectStore for trait object

Posted by "Kinrany (via GitHub)" <gi...@apache.org>.
Kinrany commented on PR #3866:
URL: https://github.com/apache/arrow-rs/pull/3866#issuecomment-1470125041

   > I wonder if Arc<dyn ObjectStore> might be more general purpose?
   
   It would carry some overhead but allow easy cloning. I'd be happy to add both; was trying to be minimal.
   
   Another possibility is a blanket impl for either AsRef or Deref, but more likely to conflict with other code.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org