-
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
pure=true
default to align with Base
#76
Comments
This was not something we added because of an abstract thinking about a problem. In particular your reasoning, while plausible is not consistent with
which clearly states that Additionally, I would expect most users of PooledArrays.jl to not be programmers but regular data scientists who are typically not aware of such subtleties unfortunately so we preferred to be on a safe side with the design. |
It's worth noting that in addition to sparse arrays, FillArrays has been using the efficient/pure implementation for a long time now, and I'm definitely wary of a diverging standard from other, very commonly-used packages. |
We could change this since in DataFrames.jl we are now safeguarded against this problem with other means. @nalimilan - what do you think? |
I've commented at JuliaSparse/SparseArrays.jl#4 (comment). TBH I doubt the |
OK - let us wait for core devs and then decide. |
I wonder whether the recent addition of various kinds of function purity (JuliaLang/julia#43852) could be used here, so that by default we would treat the function as not pure (as currently), but for functions declared as pure (technically, I guess |
I think it makes sense, as I hope e.g. functions in Base and in most important packages can be annotated this way. |
I don't think it can cause any true bugs, but I first commented when I noticed a massive performance regression in a package of mine that made it essentially unusable with big
That would be good. |
We added this functionality because of the bugs reported by users. However, I know that in many cases it causes a significant performance drop, so we need a good solution here. |
Do you think using the purity declarations added by JuliaLang/julia#43852) would be an option in that use case? |
It looks like it is, indeed, intended behavior for |
When JuliaLang/julia#44233 in Base is decided can you please ping us here. Thank you! |
I see why the
pure
keyword was added, but havingpure=false
contradicts Julia's behavior, which assumes mapped functions are pure. For instance:This default behavior is also inconsistent with most programmers' expectations, as
map
is a functional construct and therefore tends to assume side-effect free functions. This could lead to bugs; it also means that any code usingmap
on a vector of unknown type can't take advantage of the performance enhancements provided by PooledArrays, sincepure
is not a keyword for the map method in base. As a result, I propose defaulting topure=true
.The text was updated successfully, but these errors were encountered: