-
Notifications
You must be signed in to change notification settings - Fork 49
promote_rule for Type{Any} #369
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
Comments
I guess this is a problem with julia> zeros(Gray, 2, 2)
2×2 Array{Gray{Any},2} with eltype Gray:
Gray{N0f8}(0.0) Gray{N0f8}(0.0)
Gray{N0f8}(0.0) Gray{N0f8}(0.0)
julia> zeros(AbstractGray, 2, 2)
ERROR: MethodError: no method matching zero(::Type{Color{T,1} where T})
julia> zeros(RGB, 2, 2)
ERROR: MethodError: no method matching zero(::Type{RGB}) Your workaround is a "correct" manner. If you don't want to use abstract color types but just want the simple notation, julia> using ColorVectorSpace
julia> zeros(RGB, 2, 2)
2×2 Array{RGB{Any},2} with eltype RGB:
RGB{N0f8}(0.0,0.0,0.0) RGB{N0f8}(0.0,0.0,0.0)
RGB{N0f8}(0.0,0.0,0.0) RGB{N0f8}(0.0,0.0,0.0) |
Using the new promotion rules implemented in ColorTypes.jl, we can get the following result without errors. Damn! julia> hcat(mask, masked_img)
2×4 Array{RGB{Any},2} with eltype RGB:
RGB{N0f8}(0.0,0.0,0.0) RGB{N0f8}(1.0,1.0,1.0) RGB{N0f8}(0.0,0.0,0.0) RGB{N0f8}(0.541,0.349,0.294)
RGB{N0f8}(0.0,0.0,0.0) RGB{N0f8}(0.0,0.0,0.0) RGB{N0f8}(0.0,0.0,0.0) RGB{N0f8}(0.0,0.0,0.0) I'm sorry that no error is given, but I think this is a "reasonable" result.:cry: So, this is just a problem with |
Given that JuliaLang/julia#34948 is basically disapproved, is there anything that needs to be fixed in this issue? 💤 |
Originally posted by @kimikage in JuliaGraphics/ColorTypes.jl#175 (comment)
Originally posted by @kimikage in JuliaGraphics/ColorTypes.jl#175 (review) |
If we decide to make |
This is off topic, but CSS Color Module Level 4 will introduce a new color notation Anyway, the facts that a gray is:
are no longer "universal". So I don't really welcome bringing many rules about gray into ColorTypes.jl. |
Ugh. I vote we all mutate our L and S cones and go back to seeing the world in grayscale. |
The problem with |
I'm expecting the following codes work
But it throws some disgusting error 😥
P.S. This can be worked around if we do
mask = zeros(Gray{N0f8}, 2, 2)
The text was updated successfully, but these errors were encountered: