food for thought - swift 5 released - bottom types, string interpolation, and stuff.

Walter Bright newshound2 at digitalmars.com
Fri Apr 12 02:13:12 UTC 2019


On 4/11/2019 6:24 PM, Timon Gehr wrote:
>>    bool isOdd(int i) { return i & 1; }
>>
>> Filling the standard library with trivia is not a good idea.
> 
> Yes, if it is used often enough across many projects, adding functions with a 
> simple implementation can be a very good idea. The main point is to standardize 
> the function name and avoid duplicated equivalent code in everyone's personal 
> util libraries.

That would make sense if there was some application-specific higher level 
meaning to oddness, such as maybe the low bit being used as a flag. But there 
isn't when it is named "isOdd".


>> Not knowing about a common operator is not a reason to add library functions.
> No, but there can be other reasons.

That was the reason given. I'm open to hearing a better one.


More information about the Digitalmars-d mailing list