The idea is to support package set operations such as | (union), & (intersection), and - (difference), using the same operator characters that python uses for the corresponding set operations. There will be a class called PackageSetExpression that will match packages against expressions such as "( @a & @b ) - ( @c | @d )". It will be used within the dependency resolver in much the same way that the PackageSet class is currently used. This is meant to solve problems with previous set operation support which was removed in these two commits:
The issue with the previous support was that intersection between sets only worked if those sets contained identical atoms, even if those sets contained different atoms that happened to match the same packages. The new support will solve this issue by using intersection of matched packages instead of intersection of atoms. The PackageSetExpression will probably convert expressions from infix to postfix, in order to facilitate the use of a stack-based evaluation algorithm.
Unlike a PackageSet, a PackageSetExpression does not have a well-defined set of atoms that can be pulled into the dependency graph. Instead, it will have a set of candidate atoms that is generated from the sets contained in the expression. The dependency resolver will select a package instance to match a candidate atom, and then it will check whether or not the selected package actually matches the expression.