implemented Unicode operators (#18789)

* implemented Unicode operators; refs https://github.com/nim-lang/RFCs/issues/388

* bugfix

* better test

* arguably more elegant implementation

* Update changelog.md

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
This commit is contained in:
Andreas Rumpf 2021-09-03 17:31:16 +02:00 • committed by GitHub
commit c2b20516d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 117 additions and 7 deletions

View file

@ -0,0 +1,14 @@
#{.experimental: "unicodeOperators".}
proc `⊙`(x, y: int): int = x * y
proc `⊙=`(x: var int, y: int) = x *= y
proc `⊞++`(x, y: int): int = x + y
var x = 45
x ⊙= 9 ⊞++ 4 ⊙ 3
var y = 45
y *= 9 + 4 * 3
assert x == y