Proposal: Add a `.=` operator I'm not sure if thi...
# language-proposals
r
Proposal: Add a
.=
operator I'm not sure if this use case will be covered by the deep immutability enhancements that have been mentioned. The new operator would serve the same purpose to the dot operator that you get with appending
=
to other operators (e.g.
+=
,
/=
, etc.) Basically, allow replacing things like
position = position.copy(y = 10)
with
position.=copy(y = 10)
m
r
Ha, yet again my search-fu failed me. Thanks for the link 🙂
e
I've been doing quite a bit of binary manipulation lately and
= .and(mask)
= .or(set)
= .xor(flip)
aren't quite as nice as
&=
|=
^=
in other languages, but would be a much welcome improvement from the current state of things in Kotlin, IMO
❤️ 1
f
The binary operators need to become part of the language at some point, regardless of whether this feature lands, or not.
1
e
binary operators is one of the very few point where kotlin still lags behind java
👍🏻 1
once again, I invite who didn't vote yet to do it https://youtrack.jetbrains.com/issue/KT-1440
👍🏻 1
over 100 votes and still nothing.. I'm really puzzled why the community hasnt been listened here
😕 1