You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Multiple dispatch is all about the calling types and not the return type. Furthermore, trying to force a Abstract return type does not perform inheritance, but rather trying to find the necessary converters. For example, this does not work:
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _||_ __ _ | Type "?"for help, "]?"for Pkg help.
|||||||/_` | | | | |_| | | | (_| | | Version 1.3.1 (2019-12-30) _/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release|__/ |julia> abstract type MyAbstract endjulia> struct MyType <: MyAbstract a::Int endjulia> function ff(x::Int)::T where {T <: MyAbstract} MyType(x) endff (generic function with 1 method)julia> ff(1)ERROR: UndefVarError: T not definedStacktrace: [1] ff(::Int64) at ./REPL[3]:2 [2] top-level scope at REPL[4]:1
Also, by defining a return type, Julia simply calls the convert and an assert on the return type. It is not sensible to call convert(::Abstract, ::Hardtype) given a type stable function body.
Multiple dispatch is all about the calling types and not the return type. Furthermore, trying to force a Abstract return type does not perform inheritance, but rather trying to find the necessary converters. For example, this does not work:
Also, by defining a return type, Julia simply calls the convert and an assert on the return type. It is not sensible to call
convert(::Abstract, ::Hardtype)
given a type stable function body.cc @GearsAD , @Affie
The text was updated successfully, but these errors were encountered: