This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/groovy-website.git
The following commit(s) were added to refs/heads/asf-site by this push:
new 8e98db7 compound assignment operator overloading proposal (minor
tweaks)
8e98db7 is described below
commit 8e98db701609f0241a9dd7a6f27d758eb903be7e
Author: Paul King <[email protected]>
AuthorDate: Sun Apr 12 17:24:15 2026 +1000
compound assignment operator overloading proposal (minor tweaks)
---
site/src/site/wiki/GEP-15.adoc | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/site/src/site/wiki/GEP-15.adoc b/site/src/site/wiki/GEP-15.adoc
index 9bc2742..f03355d 100644
--- a/site/src/site/wiki/GEP-15.adoc
+++ b/site/src/site/wiki/GEP-15.adoc
@@ -56,7 +56,12 @@ Kotlin maps `\+=` to `plusAssign()` when available, falling
back to
* Changing the behavior of `++` and `--` operators (these use
`next()`/`previous()`
and are conceptually different).
* Changing subscript compound assignment (`a[i] += b`), which uses the existing
- `getAt`/`putAt` pattern.
+ `getAt`/`putAt` pattern. A future GEP might explore a two-argument
+ `plusAssign(key, value)` convention where `a[key] += b` maps to
+ `a.plusAssign(key, b)`, allowing containers to handle compound updates
+ atomically. Multi-dimensional cases like `a[i][j] += b` would resolve
+ naturally by peeling subscripts from the left: evaluate `a.getAt(i)` to
+ get the inner container, then apply the single-dimension rule to that result.
=== Operator method name mapping
@@ -68,8 +73,7 @@ Kotlin maps `\+=` to `plusAssign()` when available, falling
back to
| `-=` | `minusAssign` | `minus`
| `*=` | `multiplyAssign` | `multiply`
| `/=` | `divAssign` | `div`
-| `%=` | `modAssign` | `mod`
-| `%%=` | `remainderAssign` | `remainder`
+| `%=` | `remainderAssign` | `remainder`
| `**=` | `powerAssign` | `power`
| `<\<=` | `leftShiftAssign` | `leftShift`
| `>>=` | `rightShiftAssign` | `rightShift`
@@ -77,7 +81,6 @@ Kotlin maps `\+=` to `plusAssign()` when available, falling
back to
| `&=` | `andAssign` | `and`
| `\|=` | `orAssign` | `or`
| `^=` | `xorAssign` | `xor`
-| `//=` | `intdivAssign` | `intdiv`
|===
=== Resolution algorithm