Closed mauro3 closed 6 years ago
JuliaLang/julia#23211 is a won't fix, but only affects Julia 0.6. So, either this needs to wait for 0.7 or the syntax needs to be changed. A possibility is:
@traitfn f{X; Tr{X}}(x::X) = 1
# would be
@traitfn f(x::X) where trait(Tr{X})<:Tr{X} where {X} = 1
# Multitrait
@traitfn f(x::X, y::Y) where trait(Tr2{X,Y})<:Tr2{X,Y} where {X,Y} = 1
or using the syntax overhauls proposed in #45
@traitfn f(x::X) where Tr(X)<:Tr where {X} = 1
# Multitrait
@traitfn f(x::X, y::Y) where Tr2(X,Y)<:Tr2 where {X,Y} = 1
The nice thing about this is that it clearly states that a computation on the types, e.g. Tr2(X,Y)
is done, and that the result of that is then compared to some type. X-ref: https://discourse.julialang.org/t/why-does-julia-not-support-multiple-traits/5278/25, https://github.com/JuliaLang/julia/pull/18457#issuecomment-261755320
@mauro3 - would it be possible to tag a 0.7-only version of SimpleTraits so we can start migrating LightGraphs using the new where
syntax?
Yes, but I would rather wait for feature freeze to happen before spending time chasing 0.7.
Makes sense to me :) Thanks.
(Though didn't feature freeze happen on December 15?)
No, it didn't quite yet, but should soon: https://discourse.julialang.org/t/1-0-feature-freeze-dec-15th/7209/28
https://discourse.julialang.org/t/1-0-feature-freeze-dec-15th/7209/34 - any way we might be able to start soon?
I haven't forgotten this but I have not found the time yet. Sorry! Hopefully the week after next.
@sbromberger (or @rohitvarkey ): I fixed the where-syntax issue in #51. Maybe you can give that branch a spin?
@mauro3 working on it now. Hopefully will have results soon.
@mauro3 things seem to be working very well with this branch. Thank you.
@mauro3 - any chance you could tag this? We're moving ahead with https://github.com/JuliaGraphs/LightGraphs.jl/pull/848 since there are a large number of deprecations we need to fix prior to 0.7. Being able to reference it it REQUIRES would be awesome.
Perfect. Thank you :)
Yep, but needs to wait for https://github.com/JuliaLang/julia/issues/23211