Mutating functions in kwargs causes troubles

question

#1

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

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

is fine, but

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?


#2

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.