7
gitpush
13d

Was working with Swift lately, we no longer have: x++ in Swift, and I wrote rowIndex += 1, and go-lint was not happy about it ....

Comments
  • 2
    That's a pretty bad convention. The reverse is totally fine
  • 4
    https://github.com/apple/...
    Did I just read a "our developers are dumb"?
  • 1
    Did you ever have it?
  • 2
    @SortOfTested Yes it was there if I'm not mistaken in Swift 1, maybe v2 too but not sure tbh

    @jespersh Yes unfortunately, their excuse is simply implying that, who would find it hard to understand that: x++ is the same as x += 1
  • 1
    @gitpush
    Removing an operator is a bit wtf. I assume given that decision operators are just functions in swift?
  • 0
    Fun side note: in JavaScript, val += 1 and val++ do not behave the same way.
  • 2
    @gitpush The thing some find hard to understand is that (in most languages where it exists), `i++` is not just a statement (like `i += 1`, although some languages might still treat it as an expression, haven't really checked, sorry), but also an expression which returns the value of `i` before incrementation, in contrast with `++i` which returns the new value of `i`.

    It's really useful when reading through an array, but can confuse people less familiar with this mutations that return an old value. That's why a lot of new language opt not to have ++ any more. But removing it after laugh, damn that's a big ass breaking change...
Add Comment