# Best practices for feature compatible only with specific version of dependency

**URL:** <https://discourse.julialang.org/t/best-practices-for-feature-compatible-only-with-specific-version-of-dependency/110792>\
**Category:** General Usage\
**Tags:** question\
**Created:** [February 26, 2024, 4:57pm UTC](https://discourse.julialang.org/t/best-practices-for-feature-compatible-only-with-specific-version-of-dependency/110792 "2024-02-26T16:57:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)\
**Post date:** [February 26, 2024, 4:57pm UTC](https://discourse.julialang.org/t/best-practices-for-feature-compatible-only-with-specific-version-of-dependency/110792/1 "2024-02-26T16:57:44Z")

</div>

In my [`DocumenterInterLinks`](https://github.com/JuliaDocs/DocumenterInterLinks.jl) package, I would like to [add a specific feature](https://github.com/JuliaDocs/DocumenterInterLinks.jl/pull/3) that is compatible only with `Documenter >= 1.3.0`. Generally, the package is compatible with `Documenter >= 1.0.0`, and I’d like to keep it that way.

In order to handle this, I’ve [added the following](https://github.com/JuliaDocs/DocumenterInterLinks.jl/blob/828fd8d159bd75a0f11c208393266f421ad5782b/src/DocumenterInterLinks.jl#L11-L15) to my main package file:

```julia
if Documenter.DOCUMENTER_VERSION >= v"1.3.0-dev"
    include("fallback.jl")
else
    include("fallback_not_available.jl")
end

```

Here, `fallback.jl` contains the feature, and `fallback_not_available.jl` contains stumps that gracefully generate “feature not available” warnings for the older versions of `Documenter`. (And “fallback” is the name of the feature; sorry that name might be a bit confusing in this context)

It might be relevant that `fallback.jl` imports objects from `Documenter` that only exist in `Documenter > 1.3`.

Is “`include` depending on the version of the dependency” a good pattern for a situation like this?

Are there any conceivable problems with pre-compilation etc. that might make this inadvisable? The `@static` macro wouldn’t really do anything here, right?

Any alternative ideas?
