When selecting binary packages, there are cases where --binpkg-respect-use may be too strict, and it would be helpful to be able to select packages which minimize differences between built USE configuration and desired USE configuration. We can use difflib to implement this, in the same way as emerge --search uses it to implement fuzzy search.
If this were implemented, there should be a way of specifying the "importance" of a USE flag so that an important difference isn't overlooked for a minor one. For example in sys-apps/glibc, USE=headers-only has a much greater impact on the resulting package than the doc flag. Another point would be having ABI-changing flags have a very high score. Unfortunately, my suggestion here may require a future EAPI change or an additional attribute in the <use> element in metadata.xml since it is not feasible to hard-code that kind of information into portage itself.
We can allow users to side-load ranks so that they can be used without any EAPI support.
(In reply to Emily Rowlands from comment #1)
> If this were implemented, there should be a way of specifying the
> "importance" of a USE flag so that an important difference isn't overlooked
> for a minor one.
I suppose we should also allow this rank to have different values per package/USE flag combination.