-
Notifications
You must be signed in to change notification settings - Fork 13
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
Don't define unwrap(x::Any) #59
Comments
Summarizing the discussion on Slack, we should decide if we should drop the default method definition of |
In what situations can it be a problem to call |
Note that we need However, the idea of In practice the only issue I can see it the OP problem when you call |
I don't have a specific code example where this would do the wrong thing. I'm making an argument on principle. I don't understand when it would be okay to call a function on arbitrary values with unknown semantics. This may have some "pragmatic" use case in plotting or whatever but I just don't think it makes sense. This is one of those functions like |
I see your point, and maybe if we had to do it again we would avoid adding the fallback method. But now that it's there I'm reluctant to add I suspect @quinnj defined |
I think @jariji makes fair points, but I would just say in response that this was only ever intended as a very "pragmatic" sort of interface, and not a very principled one, so that's why things are the way they are. I don't think it's worth getting rid of DataValue support for slightly better principled APIs. I think it's probably more practical that we rename it to something more specific so people don't get so hung up on its current behavior. But it was definitely an API (like most in DataAPI) born out of necessity/solving a specific issue rather than some over-arching CS concept or something. |
Potentially relevant - another case of a fallback that is "too generic": #54 |
If someone has a special need for a function that disregards types, they can make their own wrapper function. The function in DataAPI that's the public function for getting values out of CategoricalValues should only take CategoricalValue. It is too easy to accidentally call
unwrap
on a type that is notCategoricalValue
, such asVector{CategoricalValue}
.See also JuliaData/CategoricalArrays.jl#399 This change is breaking so should be considered for DataAPI 2.0.
The text was updated successfully, but these errors were encountered: