4 ms·
> arrayref is a small crate of four macros. Why do so many languages fall into this horrible practice?
by tsimionescu 2mo ago
> arrayref is a small crate of four macros.
Why do so many languages fall into this horrible practice?
- bcjdjsndon 2mo agoJust like c++ thought threads wasn't a std library concern and then later changed they minds, rust will also change tac I predict
- nicoburns 2mo agoRust is actively incorporating more functionality into the stdlib. The functionality of this crate has been in std since 2024. The ecosystem is just slow to update (not everything is maintained, etc).
- silverlinex 2mo ago[flagged]
- chaps 2mo agoAre you okay?
- silverlinex 2mo agoBetter than you
- chaps 2mo agowho's you?
- rvz 2mo agoThe languages that have a poor standard library support have this issue and other languages encourage you to import tons of libraries to fix the problem. This is why Javascript and Typescript suffer from this the most and has little to nothing to do with "popularity" and likely 9/10 of these npm packages import an external library. Golang on the other-hand is just as popular and has a stronger standard library which people build against and it is encouraged to use its standard library rather than rolling your own or importing another package to solve the problem.
- tsimionescu 2mo agoI don't think it's just that, though I agree they are clearly correlated. The reason I don't think it's a sufficient explanation is that there is a clear history of large, 3rd party libraries being created exactly to supplement poor standard libraries. C++ has Boost, Java has Apache Commons (though Java also has a pretty huge standard library), arguably we could even say C has Posix/Win32/Cocoa. I believe there is some deeper cultural reason why certain language ecosystems coalesce large utility libraries, while others prefer myriad tiny dependencies.
- DanielHB 2mo agoThe reason is simple: the package manager works well. Helps if the package manager is standardized and there is a "default" registry for open source projects. I remember the days where I had to manually put the Spring .jar files into my project. No way I am doing that for 100s of dependencies.
- whstl 2mo agoThe important difference IMO is in the small vs big libraries culture. Lots of languages have a bad stdlib but don’t fall into the trap of having thousands of micro libraries. The reason people do it is because it brings clout and money. Just look for articles defending micro libs: the popular ones are by people who make a living on donations, due to maintaining 1000+ packages. And collaborating in larger libs/stdlib is hard. Plus: Rust, Node, all have a lot of visibility. You need a good stdlib culture to avoid it (like Go did).
- porridgeraisin 2mo agoYep. It comes down to the way funding flows in the ecosystem.
- weinzierl 2mo agoRich official standard library vs "import tons of libraries" are not the only two options. Java's standard library had arguably also been poor for a very long time and "import tons of libraries" just had not been practical for most of that time because the tooling and ecosystem for that did not exist yet. The solution was apache-commons and guava. Two large libraries with everything the developers heart desired and well maintained by large organizations. For Rust be probably will never have anything exactly like that because requirements from no-std development to fully fledged backend service are too diverse, but there is still room for a small number of well maintained backed by reputable developers convenience libraries in my opinion.
- wasmperson 2mo agoThere was a recent talk which explored this question (Dependency Cultures, by Richard Feldman): https://www.youtube.com/watch?v=E82ly38YEEQ https://www.youtube.com/watch?v=E82ly38YEEQ Summary: it's cultural. Rust likely inherited the practice from Nodejs, who inherited it from Ruby. I think in Rust online spaces in particular there is also this undercurrent of "you're not smart enough to use certain parts of the language, so download libraries that handle that stuff for you."
- irishcoffee 2mo ago[flagged]
- josephg 2mo ago> Rust is very much a schlong-measuring contest What? Its just a programming language. Go dependency free if you want. Or vendor everything. Nobody is forcing you to pull in 3rd party dependencies.
- silverlinex 2mo ago[flagged]
- bayindirh 2mo agoAs a person who doesn't like Rust very much, no, it doesn't suck. Some of its features make some folks very excited for very right reasons, and evokes "Silver Bullet Syndrome" in others for all the wrong reasons. People weaponizing Rust rewrites with permissive licenses is another problem, but it's not about the programming language itself.
- silverlinex 2mo agoNo. It actually does suck. See how opinions work?
- 2mo ago
- MallocVoidstar 2mo agoThey aren't trivial, at least: https://docs.rs/arrayref/0.3.9/src/arrayref/lib.rs.html#202-256 https://docs.rs/arrayref/0.3.9/src/arrayref/lib.rs.html#202-...
- vablings 2mo agoThere are two reasons you might want to use a crate, The first being that you want to use a good solid implementation that you know someone has spent more time doing and works better than almost any solution you could integrate. The second is you don't want to spend time implementing that. Writing macros in rust is a pretty horrible experience but it's not difficult
- tsimionescu 2mo agoThe horrible practice is not writing libraries, it's having individual small packages like this crate that are handled by individual small authors, and ending up with huge webs of small dependencies. The better practice is for bigger projects to form collecting such small utilities into larger utility libraries that have some organization, security practices, code reviews, etc. Good examples are Java's Apache Commons or C++'s Boost.
- vablings 2mo agoBoth the examples you provided fit into the first scenario described. See libs by dtolnay for useful tools
- deleted 2mo ago[deleted]
- account42 2mo agoOnly the ones that make it easy. Language package managers are a mistake.
- pjmlp 2mo agoUnfortunely we haven't yet gotten a universal OS agnostic package, other than zip and tarballs.
- xdavidliu 2mo agojust to clarify, by "horrible practice" you mean macros?
- Narishma 2mo agoNo, they probably mean tiny libraries.
- tsimionescu 2mo agoYes, that's what I meant.
- xdavidliu 2mo agoin that case, I would assume tiny libraries can be created in any language.