‹ BackHN Continuity

Thread

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

341 points · 107 comments · jakeasmith

  1. jakeasmith · · focus · HN ↗
    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.
    1. HackerThemAll · · focus · HN ↗
      The JavaScript world is littered with stuff comparing to which your patch seems like a complex project. See those examples:

      <a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;is-odd" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;is-odd

      <a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;is-even" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;is-even

      <a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;left-pad" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;left-pad

      <a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;is-whitespace-character" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;is-whitespace-character

      <a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;isarray" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;isarray

      1. JaggerJo · · focus · HN ↗
        what a broken ecosystem.. The crazy thing is not that the package exists, but that it is used by JS devs.
        1. junon · · focus · HN ↗
          I feel like I have to remind people of this quite often, but the history is such that npm was lightweight at one point, bundling wasn&#x27;t a thing, and while `isodd`&#x2F;`iseven` are of course silly, things like `isarray` were not functions that existed back then (we didn&#x27;t have Array.isArray). `typeof [] === &#x27;object&#x27;` in JS, so e.g. my package `is-arrayish` checked for a similar structure to an array (whereas Id guess `isarray` checked for the prototype). `isarray` failed for the `arguments` keyword, which was needed for variadics before argument spreads were added to the language I believe in ES5.

          So of course they don&#x27;t make sense now. But they were created for a reason. Before even Markov chains were a fad - let alone LLMs - we were trying to be as efficient as possible and maximize code reuse I stead of writing the same helper functions over and over again. That&#x27;s what you&#x27;re seeing.

          1. IncreasePosts · · focus · HN ↗
            You want to implement your own is-odd in your code - simple, right? isOdd = (x) =&gt; x % 2 == 1

            Ut oh, your code is broken for negative numbers now since % isn&#x27;t a true modulo operator...

            Fine then, isOdd = (x) =&gt; x % 2 != 0

            Ut oh, your code is broken because isOdd(&quot;hi&quot;) returns true now...

            Fine then, isOdd = (x) =&gt; if(!isNumber(x)) throw... else return x%2 != 0

            Ut oh, your code is now broken because isOdd(2^55+1) returns true now...

            1. rtkwe · · focus · HN ↗
              Ut oh? I&#x27;ve never seen that, is it variant on uh oh or something else?
              1. IncreasePosts · · focus · HN ↗
                It&#x27;s something I&#x27;m fighting for in my own little way.

                Everyone does a glottal stop between the &quot;uh&quot; and &quot;oh&quot;, so I&#x27;m trying to align the spelling

                Unlike the guy on him who writes all years with 5 digits like 02026, I have good reasons for my idiosyncracies.

                1. luplex · · focus · HN ↗
                  Hm, I would not spell it with a &quot;t&quot; then, but maybe with an apostrophe instead.

                  &quot;Uh&#x27;oh&quot; is more readable in my opinion and won&#x27;t be mispronou in ced

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.