Union vs intersection of version specifiers

Hi dear fellow julians. The documentation for Pkg mentions here that

The union of multiple version specifiers can be formed by comma separating individual version specifiers, e.g.

[compat]
Example = "1.2, 2"

will result in [1.2.0, 3.0.0) .

Now, in the example that is being made, that’s indeed the union of the versions sets which each specifier indicates, so that’s ok.

However, I guess one could also specify things like

[compat]
Example = ">= 0.3.0, < 1.0.0"

to indicate [0.3.0, 1.0.0). Is that an actual thing? And wouldn’t the comma in that case indicate intersection of specifiers?

Thanks!

Looks like it’s not :slight_smile:

There is only union.

Multiple < specifiers are (AFAIK) never useful.
In general prefer ^ specifiers (which are the default).
as they follow SemVer rules, and each is bounded above anmd below,
So unions of them are expressive.

2 Likes

>= 0.3.0, < 1.0.0 means >= 0.3.0 or < 1.0.0. But notice that EVERY version number meets at least one of those two criteria.

So >= 0.3.0, < 1.0.0 is equivalent to saying “every single version number in the world.”

So never use something like >= 0.3.0, < 1.0.0.

Like @oxinabox said, use either caret ^ specifiers or tilde ~ specifiers.

2 Likes