-
Notifications
You must be signed in to change notification settings - Fork 28
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
Resolve transcode
method ambiguity
#141
Resolve transcode
method ambiguity
#141
Conversation
The examples in many of the codec packages rely on being able to call `transcode` providing a `Codec` type and a string[^1][^2]. JuliaIO#136 removed type annotations from the trailing arguments for `transcode(::Type{C}, ...) where {C<:Codec}` causing a method ambiguity with `transcode(T, src::String)` in Julia `Base`[^3]. This adds an additional method to `Base.transcode` to resolve this ambiguity. Fixes JuliaIO#139. [^1]: https://github.com/JuliaIO/CodecZlib.jl/tree/f9fddaa28c093c590a7a93358709df2945306bc7#usage [^2]: https://github.com/JuliaIO/CodecZstd.jl/tree/6327ffa9a3a12fc46d465dcfc8b30bed91cf284b#usage [^3]: https://github.com/JuliaLang/julia/blob/ff7b8eb00bf887f20bf57fb7e53be0070a242c07/base/c.jl#L306
52784b6
to
642db71
Compare
In hindsight, using |
Any chance this can be merged and released @mkitti? |
I would like to go further with this. We should run |
|
Add this somewhere in the tests please.
|
Yeah sure! I should be able to add that later today. I had held off on that because that also seems to be the point of #142. |
Let's just merge that then. |
Thanks for getting this merged. Any chance we can get a new release so downstream users do not have to work around this on v0.9.12? |
The examples in many of the codec packages rely on being able to call
transcode
providing aCodec
type and a string12. #136 removed type annotations from the trailing arguments fortranscode(::Type{C}, ...) where {C<:Codec}
causing a method ambiguity withtranscode(T, src::String)
in JuliaBase
3. This adds an additional method toBase.transcode
to resolve this ambiguity.I have added tests for the
Noop
codec to ensure the ambiguity is resolved. I'm wondering whether it makes sense to add a test helper function that downstream packages can use to ensure this functionality remains intact. Let me know if that is something I should add.Fixes #139.
Footnotes
https://github.com/JuliaIO/CodecZlib.jl/tree/f9fddaa28c093c590a7a93358709df2945306bc7#usage ↩
https://github.com/JuliaIO/CodecZstd.jl/tree/6327ffa9a3a12fc46d465dcfc8b30bed91cf284b#usage ↩
https://github.com/JuliaLang/julia/blob/ff7b8eb00bf887f20bf57fb7e53be0070a242c07/base/c.jl#L306 ↩