Only a subset of available operators allow the shorthand OPERATOR=
notation. I think the current situation is that only ASCII operators are covered.
e.g.
julia> a ×= b
ERROR: syntax: unexpected "="
in eval(::Module, ::Any) at ./boot.jl:236
I think it would be reasonable if all operators which allow binary infix syntax would also allow the shorthand. (This came up when I defined a custom ⊗
operator.)
I think comparison operators should not be included, for consistency. After all, a >= b
does not mean a = a > b
.
It is always simple to define some more update operator. But the true question is whether they are _in-place_?
Not the place, @Sisyphuss.
This seems like a reasonable proposal to me – shall I mark it as accepted, @JeffBezanson?
Yes.
Not release blocking. Best!
This feature would make sense because there is no situation in Julia where an operator immediately followed by an equal sign makes sense, except as an updating operator.
For example, ∪=
could never make sense as anything but an updating operator. Since that is the case, it makes total sense to have the language support this feature.
Most helpful comment
This feature would make sense because there is no situation in Julia where an operator immediately followed by an equal sign makes sense, except as an updating operator.
For example,
∪=
could never make sense as anything but an updating operator. Since that is the case, it makes total sense to have the language support this feature.