ruuda / claxon

A FLAC decoder in Rust
Apache License 2.0
287 stars 28 forks source link

About the metadata issue #8

Closed est31 closed 6 years ago

est31 commented 6 years ago

Vorbis comment headers appear in quite many places, in vorbis, opus and in flac. Even though parsing them is only very little code, I think one could create a crate to do the parsing. What do you think? Would you use it? If yes, I'll extract the parsing code from my lewton crate :).

ruuda commented 6 years ago

I would not use it; Claxon has zero dependencies and that is a feature.

There are two extremes for the scope of a library: on the one end, there are the big frameworks, and on the other hand there are “microlibraries” (libraries that contain just one or a few functions). Big frameworks are undesirable if you only need a small part of them, because you nonetheless need to download and compile the entire thing. But microlibraries are also undesirable: they too increase download and compile time (more requests, the metadata is often larger than the code itself, the build tool needs to start a compiler process, the linker needs to do more work, etc.). Furthermore, microlibraries put more burden on the end users: they now need to check for license compatibility, keep an eye out for vulnerabilities, read the changelogs, hope that the library supports the Rust version they use, etc.

Where the benefits of reuse start to outweigh the cost of adding a dependency, is something that people should decide for themselves. I personally think the cost of dependencies is often underestimated.

For Vorbis comments specifically, the code has already been written, so the main advantage would be that bugfixes or other improvements could be shared (I don’t expect any binary size advantages, because most of the code will be inlined). But as you say, there is very little code in the first place, so I do not expect this piece of code to need a lot of maintenance. Therefore I do not think the advantages outweigh the cost in this case.

est31 commented 6 years ago

Okay, I see. I'll close this then, thanks for the reply.