food for thought - swift 5 released - bottom types, string interpolation, and stuff.
H. S. Teoh
hsteoh at quickfur.ath.cx
Thu Apr 25 23:40:31 UTC 2019
On Thu, Apr 25, 2019 at 10:49:47PM +0000, Terry Arkson via Digitalmars-d wrote:
> On Friday, 12 April 2019 at 02:29:38 UTC, Walter Bright wrote:
> > On 4/11/2019 4:24 PM, Mike Franklin 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.
[...]
> > 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.
What would be actually useful is a package called is-prime.
Unfortunately, its usefulness would be obscured by the proliferation of
packages like is-even, is-odd, and others of their ilk. Just like
comments that repeat what the code already says, thereby obscuring the
actual intent of the code while giving an illusion of being
well-documented.
/* Look, Ma! I'm so well-documented! */
// loop from 0 to len
for (i = 0; // set i to zero
i < len; // check that i is less than len
i++) // increment i
{
if (i & 2) { // if bit 0 is non-zero
writeln("How odd!");
} else { // otherwise
writeln("But even so...");
}
}
Blecch.
T
--
"I'm running Windows '98." "Yes." "My computer isn't working now." "Yes, you already said that." -- User-Friendly
More information about the Digitalmars-d
mailing list