-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
docsThis change adds or pertains to documentationThis change adds or pertains to documentation
Description
0.5:
julia> immutable Edge
src::Int
dst::Int
end
julia> src(e::Edge) = e.src
src (generic function with 1 method)
julia> dst(e::Edge) = e.dst
dst (generic function with 1 method)
julia> import Base.convert
julia> convert(::Type{Tuple}, e::Edge) = (src(e), dst(e))
convert (generic function with 597 methods)
julia> e = Edge(1,2)
Edge(1,2)
julia> Tuple(e)
(1,2)
0.6:
julia> struct Edge
src::Int
dst::Int
end
julia> src(e::Edge) = e.src
src (generic function with 1 method)
julia> dst(e::Edge) = e.dst
dst (generic function with 1 method)
julia> import Base.convert
julia> convert(::Type{Tuple}, e::Edge) = (src(e), dst(e))
convert (generic function with 700 methods)
julia> e = Edge(1,2)
Edge(1, 2)
julia> Tuple(e)
ERROR: MethodError: no method matching start(::Edge)
Closest candidates are:
start(::SimpleVector) at essentials.jl:259
start(::Base.MethodList) at reflection.jl:559
start(::ExponentialBackOff) at error.jl:107
...
Stacktrace:
[1] Tuple(::Edge) at ./tuple.jl:198
Not sure whether I missed something in NEWS again, but here we are.
Metadata
Metadata
Assignees
Labels
docsThis change adds or pertains to documentationThis change adds or pertains to documentation