[swift-evolution] Improvement proposal: change overflow behavior in successor()/predecessor() methods for Int types

Dmitri Gribenko gribozavr at gmail.com
Fri Apr 8 11:52:59 CDT 2016

On Fri, Apr 8, 2016 at 3:49 AM, Vladimir.S <svabox at gmail.com> wrote:
> On 07.04.2016 21:43, Dmitri Gribenko wrote:
>> There would be no need to.  Collection will have a .successor(of:)
>> method that returns the next index after the given one.
> I see. Thank you for letting know about this.
>> I can see that, but when you know that you are dealing with an
>> integer, isn't "+ 1" a more common and readable notation?
> Hmm.. I believe that i++ is muuuch common used than i += 1 ;-)

The reason why I said "+ 1" is because this discussion is about
Int.successor(), which returns a new Int rather than mutating it in
place.  So i++ and i += 1 are not direct replacements for


(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

More information about the swift-evolution mailing list