Live data from Hacker News

Left-Pad (2024)

azerkoculu.com

141–150 of 224 posts

Re: Left-Pad (2024)

#141
post #134

Earlier quoted context omitted.

You're missing the point. Nobody with a serious background in software development should ever need to pull in a package to pad a string or check if a number is even or odd. If someone is smart enough to use a package manager, they should be more than capable to write a function to pad a string (assuming the standard library doesn't include one already)!

How does serious background help the argument for wasting your time writing code that's already been written. By the way, why should serious people use padding from the standard library?

I would argue that a leftpad/is-odd package is the equivalent of writing a for loop. The time it cost you to search the internet, download the package, and rerun your build script cost more than the time to write the function from scratch and the behavior is indentical.

Duplicate code across the ecosystem is fine. Not every function must be unique for an entire programming language.

Re: Left-Pad (2024)

#142

Earlier quoted context omitted.

When was the last time you were threatened (“we’ll will bang on your door and take down your accounts”) by a company like Kik and you defended the principles and values you believed until the end? I’m quite familiar with both western and eastern traditions, don’t know any better source than Ghazali’s “the alchemy of happiness” about how people make decisions. It’s kind of ironic to see people being triggered by just…

[flagged]

They are citing something which changed their life significantly, and leaving pointers to the same thing if you're interested (or need further explanation).

If getting wisdom from others is not your thing, I can respect that, but low-key insulting them for leaving you pointers for a more enlightened place is rude.

You can instead say "I don't understand why Al-Ghazali relates to this", and that would be completely OK.

Re: Left-Pad (2024)

#143

Earlier quoted context omitted.

Left-pad was made at a time when tree-shaking wasn't really around, so it was good practice to only include the functions you needed to avoid making websites too heavy. If you just needed a small function then it'd be silly to include a huge utility library like Underscore.

You're missing the point. Nobody with a serious background in software development should ever need to pull in a package to pad a string or check if a number is even or odd. If someone is smart enough to use a package manager, they should be more than capable to write a function to pad a string (assuming the standard library doesn't include one already)!

Ironically I feel like this is something LLMs will improve. Now anyone can type "create left pad function" and it will essentially just vendor in the existing code.

Re: Left-Pad (2024)

#144
post #88

Earlier quoted context omitted.

> Not driven by logic, anger... I don't know that I fully buy this either, at least not the anger part. I can look back on all this with wry amusement nowadays but I remember it being pretty frustrating at the time. It sort of felt like, well, either you knew what the impact of unpublishing all your packages would be and you did it anyway, which makes you kind of antisocial, or you didn't know what the impact would b…

What’s anti-social is unilaterally making your code dependent on someone’s package and then getting mad at them when they choose to remove it. This whole problem was trivially avoidable, and people get mad at him because they were too lazy to avoid it.

They weren't too lazy to avoid it. Depending on other peoples' packages was actively encouraged within the JS community during that period, and the perceived benefits of doing so were loudly trumpeted.

Re: Left-Pad (2024)

#146
post #66

Unix philosophy is "do one thing, do it well". Left-Pad forgot about the second part. For me it was surprising that so many projects used this naive implementation. Nonnaive implementation is faster and much smaller.

I'm going to preface this with "I'm not sure if the culture is still there, nor do I develop JavaScript" ... so I'm writing about something I remember reading.

People are after the "number of downloads" metric on npm for various reasons. Left-pad has 1.4 million weekly downloads https://www.npmjs.com/package/left-pad Is-even has 160k weekly downloads https://www.npmjs.com/package/is-even

Sometimes people will include it as a dependency as a joke in their useful library. Other times the people who write these put it in useful libraries that they contribute to so that use of the useful boosts their numbers. I'm forgetting where it is now, but it was one of the big foundational libraries in React that used one of those and there was resistance to replacing (I believe) an include and use of is-even because they were a very strict adherent to the "never write code you can include" which meant that everything using it included it.

One such story: Why has there been nearly 3 million installs of is-odd - npm in the last 7 days? - https://www.reddit.com/r/programming/comments/886zji/why_has...

Re: Left-Pad (2024)

#147

Earlier quoted context omitted.

[flagged]

They are citing something which changed their life significantly, and leaving pointers to the same thing if you're interested (or need further explanation). If getting wisdom from others is not your thing, I can respect that, but low-key insulting them for leaving you pointers for a more enlightened place is rude. You can instead say "I don't understand why Al-Ghazali relates to this", and that would be completely OK…

The author made an implicit assumption, and you're making the same one, that they're filled with wisdom received straight from al-Ghazali. Firstly, only wankers act like they're wise and their audience isn't. Secondly, they said "haven't read al-Ghazali yet", implying that it's only a matter of time before everyone reads him.

Lastly, it's fine to quote someone but you need to explain how it's relevant to the conversation. The author could have summarised al-Ghazali's idea about free will or whatever and it would have been fine. But he didn't even bother, as if the ideas so basic and well known that it's not even worth doing.

I'm pretty comfortable with the way I've poked fun at the author's pompousness. If you need further explanation it's because you haven't read Chanakya yet.

Re: Left-Pad (2024)

#148

Earlier quoted context omitted.

Why does it make him sound like a wanker? That’s a very uncharitable reading for no particular reason.

[flagged]

Let's consider an example about a tangible phenomena: Gaussian Integration, Quantum Entanglement, Crystalline Structure Formation in Alloyed Metals with Heat Treatment, Combustion Dynamics in a Gasoline Engine, etc.

Let's put the same sentence:

"I'd love to explain to you, but if you haven't read $SOURCE_MATERIAL, you wouldn't understand it anyway".

Does it sound pompous and insufferable?

Re: Left-Pad (2024)

#149
post #72
post #65

I remember this incident and it is one of many reasons I was turned off by the entire JS ecosystem.

How come this is related to JS only? Like, if I own a python/rust/go/whatever public package named XYZ and later a company named XYZ forces me to release the package because of trademark issues, and I cannot do but obey, all my packages may run the same luck, so anybody relying on them would be screwed. I don’t see how the size of the package matters here.

I think the issue is that JS force you to have hundreds, or even thousands, dependencies. Python and other language have a richer std library and more "general purpose" packages, so the total number of dependencies is lower.

Re: Left-Pad (2024)

#150

Earlier quoted context omitted.

They are citing something which changed their life significantly, and leaving pointers to the same thing if you're interested (or need further explanation). If getting wisdom from others is not your thing, I can respect that, but low-key insulting them for leaving you pointers for a more enlightened place is rude. You can instead say "I don't understand why Al-Ghazali relates to this", and that would be completely OK…

The author made an implicit assumption, and you're making the same one, that they're filled with wisdom received straight from al-Ghazali. Firstly, only wankers act like they're wise and their audience isn't. Secondly, they said "haven't read al-Ghazali yet ", implying that it's only a matter of time before everyone reads him. Lastly, it's fine to quote someone but you need to explain how it's relevant to the convers…

I'll read Chanakya, but I don't see how he's supposed to appease to your taste and style of writing.

I don't think that you're pompous because you cited somebody I don't know that existed. I'm not a god. People show me things I don't know, I take note of them.

Maybe I won't agree with the direction you show me, but at least I have a new direction to discover.

This is the difference.

Post reply on HN