[swift-evolution] [Proposal draft] Enhanced floating-point protocols
Stephen Canon
scanon at apple.com
Thu Apr 14 23:41:36 CDT 2016
Hi Howard, thanks for the feedback.
> On Apr 14, 2016, at 6:05 PM, Howard Lovatt <howard.lovatt at gmail.com> wrote:
>
> +1 great addition.
>
> Would suggest the naming could be more consistent, in particular:
> Anything returning Self could be named xxxed. In the current proposal this naming convention is sometimes used, e.g. divided, and sometimes not, e.g. subtracting. Suggest all unified with the xxxed convention.
The names in the Arithmetic protocol are Dave A’s creation, but I think they’re a reasonable compromise given the constraints placed on us. While consistency would be nice, I think that clarity at use site is more important, under the rationale that code is read more often than written. Also, keep in mind that in practice, “everyone” will use the operators for arithmetic. Dave may have more to say on the subject.
> Anything returning Bool could be named isXxx. In some cases this is used, e.g. isUnordered, but not others, e.g. totalOrder.
That’s a reasonable point. isTotallyOrdered(with: ) is simple, but I’m not sure how I would handle totalOrderMagnitude( ) under this scheme. Thoughts?
Thanks,
– Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160414/691cb295/attachment.html>
More information about the swift-evolution
mailing list