Live data from Hacker News

My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it

jakeasmith.com

101–106 of 106 posts

Re: My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it

#101

Earlier quoted context omitted.

You want to implement your own is-odd in your code - simple, right? isOdd = (x) => x % 2 == 1 Ut oh, your code is broken for negative numbers now since % isn't a true modulo operator... Fine then, isOdd = (x) => x % 2 != 0 Ut oh, your code is broken because isOdd("hi") returns true now... Fine then, isOdd = (x) => if(!isNumber(x)) throw... else return x%2 != 0 Ut oh, your code is now broken because isOdd(2^55+1) retu…

> Ut oh, your code is now broken because isOdd(2^55+1) returns true now... I think you messed up this example. Whether I literally use "2^55" with XOR or replace it with "2*55", that version of isOdd returns false. False for isOdd(58) is obviously correct. (Also thanks C for permanently screwing up the precedence of bitwise operations because you didn't want to break some existing programs in 1972.) False for isOdd(3…

Sorry, it's supposed to be power. So 2**55 in JavaScript

2 to the 55th power is obviously even, so that +1 is obviously odd, but ((2*55) +1) % 2 == 0 in JavaScript.

Re: My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it

#103

Should the repo be archived? I rarely see people use that feature yet tons of repos on Github are essentially dead.

+1 on this - Jake's done the best thing with deprecating the package (which shows up locally in tooling and will also be surfaced by static analysis tooling (ie security vendors) based on that, but also archiving the repo indicates it to anyone who lands on the repo

Didn't know this was a thing. I'll look into it.

Re: My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it

#104
post #25

Are you from Nebraska?

I am, or was. Once, while living there, I wrote a little C program to read a Visual FoxPro database file and write out PostgreSQL commands to load the data. It was for my employer at the time. We needed it for a migration. And then, a year later, I got invited to a PostgreSQL convention in Brazil where it was one of the tools being quasi-formally recommended to help migrate the country off of VFP. The world can feel…

For real? Wow, i was just referencing the xkcd comic: https://xkcd.com/2347/ what a funny coincidence

Re: My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it

#105
post #24

Author here, happy to answer any questions. I never imagined a polyfill for http_build_url would gain so much traction. After 12 years, deprecating it feels like the right move, especially given the new options from the community and PHP itself.

From the article: > So I had a decision to make. I could dive back into PHP after almost a decade away, hand the package to one of the people who’d offered, or let it keep sitting there. We are in the AI era. As a maintainer of an open source project that I haven't touched for years, I would first start by asking an AI to produce a fix for the issue and check what it proposes. This definitely reduces the mental load…

> check what it proposes

This requires re-learning the language he's out of practice with.

Re: My temporary PHP fix from 2014 has nearly 20M installs. Today I'm deprecating it

#106

Earlier quoted context omitted.

> Ut oh, your code is now broken because isOdd(2^55+1) returns true now... I think you messed up this example. Whether I literally use "2^55" with XOR or replace it with "2*55", that version of isOdd returns false. False for isOdd(58) is obviously correct. (Also thanks C for permanently screwing up the precedence of bitwise operations because you didn't want to break some existing programs in 1972.) False for isOdd(3…

Sorry, it's supposed to be power. So 2**55 in JavaScript 2 to the 55th power is obviously even, so that +1 is obviously odd, but ((2*55) +1) % 2 == 0 in JavaScript.

But there's no bug in isOdd. You're sending the number 36028797018963970 into it, which is clearly even.

Putting extra code between the parentheses of the function call doesn't make it the function's responsibility. As nice as it would be for debugging if you could stuff your entire program inside of isNaN((function(){ /* your code here */ })()) and force your browser vendor to fix all problems.

Post reply on HN