# Function dispatch ignores keyword arguments

**URL:** https://discourse.julialang.org/t/function-dispatch-ignores-keyword-arguments/60887
**Category:** General Usage
**Created:** [May 10, 2021, 12:52pm UTC](https://discourse.julialang.org/t/function-dispatch-ignores-keyword-arguments/60887 "2021-05-10T12:52:11Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![tqml](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tqml/32/22710_2.png) [@tqml](https://discourse.julialang.org/u/tqml)
#### Post date: [May 10, 2021, 12:52pm UTC](https://discourse.julialang.org/t/function-dispatch-ignores-keyword-arguments/60887/1 "2021-05-10T12:52:11Z")

</div>

Today I stumbled upon some weird Julia behavior. It seems that it is not possible to have multiple keyword-only functions with the same name. Is this a bug or intended behavior?

```julia
f1(;a,b) = println("a,b") # defines f1
f1(;a,b,c) = println("a,b,c") # redefines f1, deletes prev. definition
f1(;x,y) = println("x,y") # redefines f1, deletes prev. defintion

f1(x=1,y=2) # works
f1(a=1,b=1,c=0) # fails, keyword `x` not assigned
f1(a=1,b=1) # fails, keyword `x` not assigned

```

Thank you in advance!

---

<div class="post-metadata">

### Author: ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)
#### Post date: [May 10, 2021, 12:55pm UTC](https://discourse.julialang.org/t/function-dispatch-ignores-keyword-arguments/60887/2 "2021-05-10T12:55:40Z")

</div>

That is intended.

---

<div class="post-metadata">

### Author: ![johnmyleswhite](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnmyleswhite/32/31_2.png) [@johnmyleswhite](https://discourse.julialang.org/u/johnmyleswhite)
#### Post date: [May 10, 2021, 12:56pm UTC](https://discourse.julialang.org/t/function-dispatch-ignores-keyword-arguments/60887/3 "2021-05-10T12:56:34Z")

</div>

The relevant part of the manual is [Methods · The Julia Language](https://docs.julialang.org/en/v1/manual/methods/#Note-on-Optional-and-keyword-Arguments).

> Keyword arguments behave quite differently from ordinary positional arguments. In particular, they do not participate in method dispatch. Methods are dispatched based only on positional arguments, with keyword arguments processed after the matching method is identified.

---

<div class="post-metadata">

### Author: ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)
#### Post date: [May 10, 2021, 12:59pm UTC](https://discourse.julialang.org/t/function-dispatch-ignores-keyword-arguments/60887/4 "2021-05-10T12:59:08Z")

</div>

Check out KeywordDispatch.jl
