Re: swift and objective-c
Re: swift and objective-c
- Subject: Re: swift and objective-c
- From: Jeremy Pereira <email@hidden>
- Date: Wed, 04 Jun 2014 16:51:58 +0100
On 4 Jun 2014, at 15:30, Scott Ribe <email@hidden> wrote:
> On Jun 4, 2014, at 8:09 AM, Jeremy Pereira <email@hidden> wrote:
>
> The modulo operation is precisely defined, x mod y results in a positive integer between 0 and y - 1.
You need to think about that definition again. It's nonsense if y is negative.
> Any operation that does not adhere to that definition is not the modulo operation, and calling it such is incorrect.
Agreed, but neither Swift nor C99 call the % operator "modulo", they both use the term "remainder" (c99 section 6.5.5, The Swift Programming Language Basic Operators/The Remainder Operator . Given the behaviour of integer division in both of these languages (round towards zero), the behaviour of the % operator is correct.
Given that Swift apparently allows the invention of new operators (I haven't read that far in the book yet), there's no reason not to add your own pair of operators that work the way you want.
>
> --
> Scott Ribe
> email@hidden
> http://www.elevated-dev.com/
> (303) 722-0567 voice
>
>
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden