tk3369
1
Is SimpleTraits still supported in 0.6? This simple code from the test suite fails. Note that it works fine on Julia 0.7.
julia> using SimpleTraits
julia> @traitdef Tr1{X}
julia> @traitimpl Tr1{Integer}
julia> const trait = SimpleTraits.trait
trait (generic function with 11 methods)
julia> trait(Tr1{Int})
Tr1{Int64}
julia> @traitfn f(x::X) where {X; Tr1{X}} = 1 # def 1
ERROR: MethodError: no method matching start(::Void)
Closest candidates are:
start(::SimpleVector) at essentials.jl:258
start(::Base.MethodList) at reflection.jl:560
start(::ExponentialBackOff) at error.jl:107
...
mauro3
2
Sorry, but the where
function syntax is not supported in Julia 0.6 due to the {X; Tr{X}}
not parsing as needed: where-syntax accepts ; as separator in 0.6 · Issue #23211 · JuliaLang/julia · GitHub. Note though that the old function syntax still works in 0.7, but of course throws deprecation warnings.
tk3369
3
Thanks, I have found examples from the old README file.
@traitfn f{X; Tr1{X}}(x::X) = 1
mauro3
4
Yep, this was pretty hidden. I now added a link back to the last 0.6 version to the README: https://github.com/mauro3/SimpleTraits.jl/tree/master#manual.