> On Feb 22, 2017, at 10:39 AM, Max Moiseev <[email protected]> wrote:
>
> Free functions are much less discoverable. Think about the code completion,
> for example.
>
>> On Feb 22, 2017, at 6:01 AM, David Sweeris <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>>
>> On Feb 21, 2017, at 20:46, Xiaodi Wu via swift-evolution
>> <[email protected] <mailto:[email protected]>> wrote:
>>
>>> Sign, perhaps, can be thought of as "part of a number," but signum refers
>>> to the signum function (http://en.wikipedia.org/wiki/Sign_function
>>> <http://en.wikipedia.org/wiki/Sign_function>) defined as:
>>>
>>> -1 if x < 0
>>> 0 if x = 0
>>> 1 if x > 0
>>>
>>> 1 isn't really "part of" 42, for instance, at least not in the sense that
>>> 42 and + are "part of" 42.
>>
>> Should it be a stand-alone function, then?
Eh, maybe… At least in Xcode, autocomplete works for free functions. I was just
thinking about how people who already know about “signum" would expect it to
work. Like if a mathematician sits down to write something in Swift, are they
more likely to try “signum(x)” or “x.signum” first?
- Dave Sweeris
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution