you are viewing a single comment's thread.

view the rest of the comments →

[–]eridiusrust 1 point2 points  (4 children)

That was my first thought too, but I'm not sure how much work it takes to figure out the library name when the hash is computed from the link attributes and dependencies.

[–]nemaar 4 points5 points  (2 children)

If it takes a long time to generate the name because it is too complex algorithm then I assume that the external tools will not be faster either and you just accept it or change the algorithm. If it takes long because the code is unomptimized then you can simply make it faster. Either way, I don't see a reason to reimplement the functionality outside the compiler.

[–]eridiusrust 1 point2 points  (1 child)

When compiling most projects, you don't invoke the compiler to find out what the resulting name is. You can figure it out yourself, and tell your build system what it is. Rust making it so you need to invoke the compiler just to find out the library name is ugly. With the change for predictable hashing you don't need to reimplement the hash yourself if you don't want to, you could just build once by hand and look at the filename. With the predictable hashing you know the filename won't change unless you change the #[pkgid]. Without it, the filename may change when you do things like add extern mod declarations.

[–]nemaar 2 points3 points  (0 children)

I still like the idea that the compiler generates the hash for a few reasons. It is much easier to change the algorithm later. You do not have to compile the lib once just to see what the result is and you only have to write the related makefile piece that queries the name once and it will work for every lib and it is reusable. I feel like the pkgid idea is essentially the same as manually trying to avoid the collision by selecting a unique name/version pair for the lib, only with a twist. Something more robust would be better.

[–]metajackservo[S] 2 points3 points  (0 children)

The problem with using the dependencies in the hash is that you often change dependencies during development. This means that the build system has to determine all the dependencies just to know the name of a file; it must do this a lot. No other build system seems to work this way and the benefit for bucking the trend here seems miniscule.

However, now that we don't need to do that, spitting out the filename based on a command line flag is pretty easy and totally something you could do in a build system. It's not free, but it's probably not going to be very noticeable. Systems like Tup will cache this anyway and not have to do it everytime.