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

aliak something at something.com
Fri Apr 12 07:07:54 UTC 2019


On Friday, 12 April 2019 at 03:04:19 UTC, Andrei Alexandrescu 
wrote:
> On 4/11/19 10:29 PM, Walter Bright wrote:
>>> 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".
>
> Very well put.
>
> Funny tidbit: "% 2 == 0 appears 63 times in the Apple/Swift 
> repository." That argument is quoted straight from the 
> proposal. Of course, they conveniently neglect to mention that 
> the project has over 2.4 MILLION lines of code. That's 
> 0.002625% or better put 26 ppm. IF there's an argument in 
> there, it must be of a homeopathic nature.
>
> The day we talk ourselves into entering the ilk of isOdd and 
> isEven into the standard library someone please slip me that 
> misericorde.

Not sure these numbers matter. It's the same as adding an 
identifier to a string that's used more than once. Would you find 
someone replacing a the string "xyz" with a constant surprising 
if it was used more than once even? Even if the project had 
centrillion lines of code?

For the record, I don't see a super need to add an isodd or 
iseven - i do see the value though. But asking for a misericorde 
is being a bit dramatic don't you think? :)

Anyway, someone recently posted this gem - 
https://fs.blog/2016/04/second-order-thinking/ ;). The second 
order here would be 
maintainability/learnability/adoption/pleasantness-of-reading/probably-more




More information about the Digitalmars-d mailing list