food for thought - swift 5 released - bottom types, string interpolation, and stuff.
Timon Gehr
timon.gehr at gmx.ch
Fri Apr 12 01:24:02 UTC 2019
On 12.04.19 01:03, Walter Bright wrote:
> On 4/11/2019 2:21 PM, Dennis wrote:
>> I don't get it. What's shocking about it, that people often need to
>> know the parity of a number or that people aren't born with the
>> knowledge that the % operator can be used for that?
>
> 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.
> Not knowing about a common operator is not a reason to add library functions.
No, but there can be other reasons.
More information about the Digitalmars-d
mailing list