# Mutating functions in kwargs causes troubles

**URL:** <https://discourse.julialang.org/t/mutating-functions-in-kwargs-causes-troubles/1610>\
**Category:** Internals & Design\
**Tags:** question\
**Created:** [January 20, 2017, 11:02am UTC](https://discourse.julialang.org/t/mutating-functions-in-kwargs-causes-troubles/1610 "2017-01-20T11:02:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [January 20, 2017, 11:02am UTC](https://discourse.julialang.org/t/mutating-functions-in-kwargs-causes-troubles/1610/1 "2017-01-20T11:02:43Z")

</div>

Mutating functions in keyword arguments give quite an issue due to how it’s parsed. The following example was noticed:

[https://github.com/JuliaDiffEq/DiffEqBase.jl/issues/18](https://github.com/JuliaDiffEq/DiffEqBase.jl/issues/18)

```julia
callback = ContinuousCallback(condtion,affect_bounce!,rootfind,save_positions,affect_neg! = affect_negative!)

```

is fine, but

```julia
callback = ContinuousCallback(condtion,affect_bounce!,rootfind,save_positions,affect_neg!=affect_negative!)

```

errors because Julia reads `affect_neg!=affect_negative!` as having a `!=`. Does this just mean we should avoid the `!` in keyword arguments? Or is this a parser issue that should be fixed?

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [January 20, 2017, 11:49am UTC](https://discourse.julialang.org/t/mutating-functions-in-kwargs-causes-troubles/1610/2 "2017-01-20T11:49:53Z")

</div>

Since `affect_neg!=affect_negative!` is valid on the parser level (your function could just take a bool argument in that position), there’s no way to fix this in the parser itself. So avoiding `kwarg!` seems like the most sensible option to me.
