Julia: Dispatch on Pair

Created on 30 Oct 2016  路  2Comments  路  Source: JuliaLang/julia

   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.6.0-dev.975 (2016-10-24 19:00 UTC)
 _/ |\__'_|_|_|\__'_|  |  scan/0929f08* (fork: 5 commits, 16 days)
|__/                   |  x86_64-linux-gnu

julia> f{K}(::Pair{K}) = 1
f (generic function with 1 method)

julia> f{K, V}(::Pair{K, V}) = 2
f (generic function with 2 methods)

julia> f("a"=>123)
1
types and dispatch

Most helpful comment

I can already confirm this will be fixed by #8974, after which the two signatures are type-equal and the second definition overwrites the first (with usual warning).

All 2 comments

I can already confirm this will be fixed by #8974, after which the two signatures are type-equal and the second definition overwrites the first (with usual warning).

Dup of #18892

Was this page helpful?
0 / 5 - 0 ratings