[swift-users] Design guidelines for computed property vs no-arg method

Dave Abrahams dabrahams at apple.com
Thu Jul 6 16:14:08 CDT 2017


on Wed Jul 05 2017, Jens Persson <swift-users-AT-swift.org> wrote:

> On Wed, Jul 5, 2017 at 11:50 PM, Dave Abrahams via swift-users <
> swift-users at swift.org> wrote:
>
>>>> As a name, signum falls into the “term-of-art” category, so at least
>> that part is in conformance to the guidelines.  In specialized areas
>> like this one, I generally defer to the domain experts, and IIRC our
>> numerics people thought a function was more appropriate.  In general,
>> though, we were unable to come up with solid guidelines for the use of
>> properties vs. functions.  You can read more about this in the thread
>> that starts here:
>> https://lists.swift.org/pipermail/swift-evolution/
>> Week-of-Mon-20160125/007927.html
>>
>>
> Thanks, I'll read that thread.
> I am however noting that FloatingPoint.sign is a computed property.
> Seems to me like the "term-of-art" category is a rather fussy and
> complicated/complicating concept.

I understand.  Unfortunately it is necessary unless we are going—for
example—to start spelling out sine(x) and cosine(x), which would not be
acceptable to important constituencies of the language.

-- 
-Dave



More information about the swift-users mailing list