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

Terry Arkson email at example.org
Thu Apr 25 22:49:47 UTC 2019


On Friday, 12 April 2019 at 02:29:38 UTC, Walter Bright wrote:
> On 4/11/2019 4:24 PM, Mike Franklin wrote:
>> On Thursday, 11 April 2019 at 23:03:00 UTC, Walter Bright 
>> wrote:
>> 
>>>   bool isOdd(int i) { return i & 1; }
>>>
>>> Filling the standard library with trivia is not a good idea. 
>>> Not knowing about a common operator is not a reason to add 
>>> library functions.
>> 
>> For me it's not about knowledge of the operator.
>
> That was the reason given for it.
>
>
>> It's about conveying the reason for why that operation is 
>> being done.  For example, if you do `i & 1` are you checking 
>> for even or odd, or are you masking off irrelevant bits.
>
> If you're masking bits, you should call it:
>
>    return i & MyBitFlag;
>
>
>> Creating functions like `isOdd` or `GetLeastSignificantBit` 
>> help convey intent without having to supplement code with 
>> comments.
>
> No they don't. For example, if I saw "isOdd" in code, I'd 
> wonder what the heck that was doing. I'd go look up its 
> documentation, implementation, test cases, etc., find out "oh, 
> it's just doing the obvious thing", and be annoyed at the waste 
> of my time.
>
> It wastes the time of everyone reading the code, documenting 
> the function, and the QA staff. It hides the useful stuff in 
> the library when it's alongside a morass of junk like this. It 
> wastes the time of the poor shlub perusing the library. It 
> makes the library look like a bunch of filler rather than 
> useful stuff.
>
> I don't believe anybody's code is so well-documented that this 
> is all that's left. Meaning you're wasting your time 
> documenting the wrong things.
>
> I call this sort of stuff the "Illusion of Progress".

Sorry to bump an old (hijacked) thread, but I have just 
discovered something hilarious that absolutely needs to go here:

The same author of the is-odd npm package also has a package 
called 'is-even'.
Now that, I'm sure we can all agree, is bullshit.


More information about the Digitalmars-d mailing list