[swift-evolution] [Proposal draft] Enhanced floating-point protocols

Howard Lovatt howard.lovatt at gmail.com
Mon Apr 18 20:02:02 CDT 2016


+1 `prefix -=`, it logically follows :)

  -- Howard.

On 19 April 2016 at 09:02, <davesweeris at mac.com> wrote:

> "prefix -=“?
>
> (I’m not sure if I’m serious)
>
> - Dave Sweeris
>
> On Apr 18, 2016, at 5:57 PM, Howard Lovatt <howard.lovatt at gmail.com>
> wrote:
>
> I think `prefix -` works for `negated` (non-mutating form) but not
> `negate` (mutating form). IE `-=` is the mutating form of `infix -` and
> there is no equivalent in C-like languages for `negated` :(
>
>   -- Howard.
>
> On 19 April 2016 at 08:28, <davesweeris at mac.com> wrote:
>
>> On Apr 16, 2016, at 6:12 PM, Howard Lovatt via swift-evolution <
>> swift-evolution at swift.org> wrote:
>>
>> For the Arithmetic protocol how about changing it to:
>>
>>     protocol Arithmetic {
>>         func + (lhs: Self, rhs: Self) -> Self
>>         mutating func += (rhs: Self) -> Self
>>         ...
>>     }
>>
>> That way naming issues are largely avoided, except for `mutating func
>> negate()` which has no operator and would therefore have to be a normal,
>> non-operator, func.
>>
>> “prefix -" works for negate, at least off the top of my head.
>>
>> I think.
>>
>> - Dave Sweeris
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160419/169e2ab0/attachment.html>


More information about the swift-evolution mailing list