Eliminate usages of the old non-typed API#58
Eliminate usages of the old non-typed API#58casperisfine wants to merge 1 commit intoruby:masterfrom
Conversation
Ref: https://bugs.ruby-lang.org/issues/19998 I'd like to enable deprecation warnings for the old API so that gem authors can be made aware that it would be best to upgrade to `TypedData`. Digest is one of the last users of it inside Ruby itself.
| #define RUBY_UNTYPED_DATA_WARNING 0 | ||
| return rb_obj_freeze(Data_Wrap_Struct(0, 0, 0, (void *)meta)); | ||
| } | ||
| VALUE rb_digest_make_metadata(const rb_digest_metadata_t *meta); |
There was a problem hiding this comment.
This doesn't work on all platforms.
rb_ext_resolve_symbol is added for the case like this.
Also, older version of digest didn't provide this function, this is a binary incompatibility.
There was a problem hiding this comment.
I don't think I understand all of that. I see it was added a bit before Ruby 3.0 release 7046fe6
What I'm trying to do is to stop suggesting to use a deprecated API in the digest documentation. What could be a better solution?
There was a problem hiding this comment.
rb_digest_make_metadata is static inline now and it will be inlined in each extension library.
But this PR moves it to digest.c.
The point is that a symbol in an extension library may not be referred from another extension library.
|
@casperisfine Thank you for your contribution and I'm sorry for not reviewing this right away. @nobu came up with a similar set of changes that offer better compatibility (which is important here), so we are going with his version this time, but I greatly appreciate your taking the time to address this. We look forward to your next contribution! |
|
@knu no worries at all, this was as much of a PR than an issue to point the doc recommending a deprecated API. I'm glad nobu found a solution. |
Ref: https://bugs.ruby-lang.org/issues/19998
I'd like to enable deprecation warnings for the old API so that gem authors can be made aware that it would be best to upgrade to
TypedData.Digest is one of the last users of it inside Ruby itself.