[swift-evolution] Reconsider ++ and -- operators removal and prevent other well-known operators from change

Jonathan Tang jonathan.d.tang at gmail.com
Sun Jan 31 18:39:24 CST 2016

On Sun, Jan 31, 2016 at 6:19 AM, Tino Heth via swift-evolution <
swift-evolution at swift.org> wrote:

> I do not know how far the Swift is to the adolescence, but it is certain
> that teenagers are rebels. There's something very good at it. In most cases
> they are to be certain. But in some things they regret later.
> Children have to learn their own lessons — and I guess re-adding "++"
> wouldn't be as complicated as a big tattoo on your neck ;-)
> My first thought on the removal was "we'll see many custom post-increment
> operators soon", and that may be true; but in the meantime, I came to the
> conclusion that I won't define those custom operators, but rather configure
> my system to replace "++" with " += 1":
> Typing the old operator is definitely faster, but I don't mind if it's
> turned into something else automatically (when there is no performance gain
> for pre-increment, I've always preferred the post-variants).
FWIW, Python has no ++ and -- operators (you have to use += 1 or -= 1), and
nobody misses them there.  Once you introduce for-each loops, about 99% of
the usage sites for ++ disappear, and it quickly fades out of your muscle

It used to get re-introduced every so often by having to work with C, Java,
and Javascript, but now ES6, Java, Objective-C, PHP, Python, Ruby, Go,
Rust, and even C++ all have for-each loops or iteration blocks, so there's
basically no need for regular for-loops or increment operators in any
language but C.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160131/a0af389e/attachment.html>

More information about the swift-evolution mailing list