# Chaining in named arguments

**URL:** <https://discourse.julialang.org/t/chaining-in-named-arguments/62696>\
**Category:** General Usage\
**Created:** [June 10, 2021, 7:16pm UTC](https://discourse.julialang.org/t/chaining-in-named-arguments/62696 "2021-06-10T19:16:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tlienart](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tlienart/32/7640_2.png) [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Post date:** [June 10, 2021, 7:16pm UTC](https://discourse.julialang.org/t/chaining-in-named-arguments/62696/1 "2021-06-10T19:16:13Z")

</div>

I stumbled upon this when trying to debug something that had happened for a user:

```julia
foo(; x=1, y=1) = print("x: $x, y: $y") 
foo() # x: 1, y: 1
foo(; x=y=0) # x: 0, y: 1

```

initially I thought that the last one would just fail but it actually works, though, it seems to me, in a bit of counterintuitive way?

I’m not really looking for a solution, maybe just a comment as to why this is the case and whether this is desirable. IMO the chaining in arguments itself should maybe just fail but this might be more complex than I think.

cc @lazarusA

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [June 10, 2021, 7:19pm UTC](https://discourse.julialang.org/t/chaining-in-named-arguments/62696/2 "2021-06-10T19:19:29Z")

</div>

It’s just an issue of precedence. see

```julia
julia> t = :(foo(; x=y=0))
:(foo(; x = (y = 0)))

```

So the `y` keyword argument is never called.

---

<div class="post-metadata">

**Author:** ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Post date:** [June 10, 2021, 11:00pm UTC](https://discourse.julialang.org/t/chaining-in-named-arguments/62696/3 "2021-06-10T23:00:54Z")

</div>

Yeah, ditto what @pdeffebach said. Assignments are also expressions with a value, which is why we are able to do

```julia
a = b = 1

```
