News for hackers. Stuff that matters.
Re:Left-Pad (2024) by yurishimo on Wednesday June 11, 2025 @09:07AM (#44247198)
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) by eviks on Wednesday June 11, 2025 @10:15AM (#44247871)
What about the time it cost you to search the internet, read the docs, and use the one from std? How many seconds does each variant take (with hot/cold memory cache?)

And the behavior could also be worse, there is no guarantee of perfection.

The last argument is too generic to offer any guidance. Why is it better for this function be duplicated?? Should it not be part of std to avoid uniqueness?

Re:Left-Pad (2024) by Izkata on Wednesday June 11, 2025 @06:25PM (#44252484)
> Should it not be part of std to avoid uniqueness?

> > > > (assuming the standard library doesn't include one already)

Re:Left-Pad (2024) by eviks on Wednesday June 11, 2025 @10:11PM (#44253699)
This doesn't address the should