# Union vs intersection of version specifiers

**URL:** <https://discourse.julialang.org/t/union-vs-intersection-of-version-specifiers/31193>\
**Category:** General Usage\
**Tags:** pkg\
**Created:** [November 17, 2019, 10:35pm UTC](https://discourse.julialang.org/t/union-vs-intersection-of-version-specifiers/31193 "2019-11-17T22:35:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lostella](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lostella/32/356_2.png) [@lostella](https://discourse.julialang.org/u/lostella)\
**Post date:** [November 17, 2019, 10:35pm UTC](https://discourse.julialang.org/t/union-vs-intersection-of-version-specifiers/31193/1 "2019-11-17T22:35:28Z")

</div>

Hi dear fellow julians. The documentation for Pkg mentions [here](https://julialang.github.io/Pkg.jl/v1/compatibility/index.html#Version-specifier-format-1) that

> The union of multiple version specifiers can be formed by comma separating individual version specifiers, e.g.
> 
> ```julia
> [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

```julia
[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!

---

<div class="post-metadata">

**Author:** ![lostella](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lostella/32/356_2.png) [@lostella](https://discourse.julialang.org/u/lostella)\
**Post date:** [November 17, 2019, 10:39pm UTC](https://discourse.julialang.org/t/union-vs-intersection-of-version-specifiers/31193/2 "2019-11-17T22:39:55Z")

</div>

> [@lostella](#):
>
> Is that an actual thing?

Looks like it’s not 🙂

---

<div class="post-metadata">

**Author:** ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Post date:** [November 17, 2019, 11:26pm UTC](https://discourse.julialang.org/t/union-vs-intersection-of-version-specifiers/31193/3 "2019-11-17T23:26:30Z")

</div>

There is only union.

> [@lostella](#):
>
> Example = “\>= 0.3.0, \< 1.0.0”

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.

---

<div class="post-metadata">

**Author:** ![dilumaluthge](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dilumaluthge/32/29283_2.png) [@dilumaluthge](https://discourse.julialang.org/u/dilumaluthge)\
**Post date:** [November 17, 2019, 11:51pm UTC](https://discourse.julialang.org/t/union-vs-intersection-of-version-specifiers/31193/4 "2019-11-17T23:51:02Z")

</div>

> [@oxinabox](#):
>
> Example = “\>= 0.3.0, \< 1.0.0”

`>= 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.
