-
Notifications
You must be signed in to change notification settings - Fork 22
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
type piracy in convert
causes ambiguity errors
#29
Comments
Really? This is only called when a |
This is a bit of a grey area, but defining methods on functions you don't own on types you don't own, even if you own one of the type parameter can still lead to unexpected behavior. The reproducer for this is quite easy, you just call |
I aggree with @simeonschaub. All these |
In principle that would be fine. However, wouldn't then the ambiguity come from this method (if we rename it Line 20 in 6212c61
convert(Any, MDBVal) would be ambigous? I personally would suggest two options to solving this:
Probably @simeonschaub will suggest to implement the first option, although my lazy self go rather go for 2) |
It's your package, so I won't tell you how it's supposed to work. You might be interested in the discussion in invenia/Intervals.jl#144 regarding approach 2 though. |
Ok, thanks for the link. I will check their proposed solution in more detail and will probably go for 1) then. |
This definition of
convert
is type piracy, since LMDB doesn't own theRef
type:LMDB.jl/src/common.jl
Line 12 in 6212c61
Among the usual problems with type piracy, this also causes ambiguities for
convert(Any, ::Ref{MDB_val})
. Caught in the PkgEval run for JuliaLang/julia#43671, see: https://s3.amazonaws.com/julialang-reports/nanosoldier/pkgeval/by_hash/3656ddf_vs_1db8b8f/LMDB.primary.logI'd recommend just removing this definition.
The text was updated successfully, but these errors were encountered: