News for hackers. Stuff that matters.
Re:Virtual DOM is pure overhead (2018) by sam0x17 on Sunday May 19, 2019 @03:46AM (#19952038)
Convenience is to be taken with a grain of salt, though. In the node.js world, "is-odd" can be a package, and it can have 926,000 weekly downloads and 22 dependents.
Re:Virtual DOM is pure overhead (2018) by nailer on Sunday May 19, 2019 @04:22AM (#19952176)
Makes sense, you don't want to write your own tests for handling zero.
Re:Virtual DOM is pure overhead (2018) by DonHopkins on Sunday May 19, 2019 @05:39AM (#19952397)
Teach the Controversy [TM]!

https://en.wikipedia.org/wiki/Parity_of_zero#Education

Claims made by students:

    "Zero is not even or odd."
    "Zero could be even."
    "Zero is not odd."
    "Zero has to be an even."
    "Zero is not an even number."
    "Zero is always going to be an even number."
    "Zero is not always going to be an even number."
    "Zero is even."
    "Zero is special."
https://en.wikipedia.org/wiki/Teach_the_Controversy
Re:Virtual DOM is pure overhead (2018) by hyperdimension on Sunday May 19, 2019 @07:22AM (#19952742)
Just so you know (not just for this comment)--you are my favorite HN user. Everything you post is either funny, quirky, or extremely interesting (mostly all of the above).
Re:Virtual DOM is pure overhead (2018) by oblio on Sunday May 19, 2019 @02:11PM (#19954583)
And, to add to this (I'm not being snarky), he could be the father/grandfather of many HNers. I recall one of his comments about how he was doing stuff on computers in 1965.

We need more old coders around!

Re:Virtual DOM is pure overhead (2018) by DonHopkins on Monday May 20, 2019 @02:52AM (#19958082)
Thanks, but my age was negative in 1965! (But not very.) Maybe I was taking credit for somebody else's work and forgot to get my story straight. ;)

Old coders never die, they just get frozen until their favorite programming languages come back into fashion.

https://medium.com/@donhopkins/cobol-forever-1a49f7d28a39

Re:Virtual DOM is pure overhead (2018) by mercer on Sunday May 19, 2019 @07:29AM (#19952762)
To add some positivity, I'll add that I'm also a fan :).
Re:Virtual DOM is pure overhead (2018) by rocqua on Sunday May 19, 2019 @07:36AM (#19952787)
I mean, zero is so even, it is not even odd!
Re:Virtual DOM is pure overhead (2018) by fauigerzigerk on Sunday May 19, 2019 @05:32AM (#19952383)
is-odd doesn't have any tests for handling zero. What would they be anyway?

What is-odd does is to throw an exception if you pass anything that isn't a safe integer or a string representation of a safe integer. Otherwise it just returns n % 2 === 1 (after converting string to int if necessary)

Re:Virtual DOM is pure overhead (2018) by DonHopkins on Sunday May 19, 2019 @05:43AM (#19952410)
You don't want to start a religious war between the people who believe zero is special, and the ones who believe it should throw an error if you pass a string, and the people who believe it should attempt to convert the string to an integer, and the people who believe you should either round or truncate when the parameter is a floating point number, and the people who disagree about which direction to round, and the people who can't agree whether you should truncate towards zero or negative infinity.
Re:Virtual DOM is pure overhead (2018) by e12e on Sunday May 19, 2019 @09:30AM (#19953192)
> should either round or truncate when the parameter is a floating point number

Isn't the parameter always floating point in Javascript? (which does mean a package like isOdd will have to incorporate some level of mysticism...)

Re:Virtual DOM is pure overhead (2018) by marcosdumay on Sunday May 19, 2019 @11:31AM (#19953758)
Let the fight begin! It goes well with some popcorn.

I can understand how fundamental education teachers don't grasp modern Algebrism and believe that Math is formed by fundamental, sacred definitions. But programmers ought to know better.

Re:Virtual DOM is pure overhead (2018) by pcmaffey on Sunday May 19, 2019 @12:11PM (#19953998)
And my favorite case - that zero is false. (!!0)
Re:Virtual DOM is pure overhead (2018) by sam0x17 on Sunday May 19, 2019 @11:01AM (#19953609)
Yeah but point being, if you need to use is-odd, what you probably need more is something tailored to your particular application.
Re:Virtual DOM is pure overhead (2018) by layoutIfNeeded on Sunday May 19, 2019 @06:33AM (#19952583)
lol, zero is even.