Hacker News new | ask | show | jobs
by eviks 367 days ago
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?
2 comments

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.

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?

> Should it not be part of std to avoid uniqueness?

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

This doesn't address the should
The standard library is a far less risky dependency than third-party libraries. It's far more reliable in presence and behavior.