Skip to content

dub.selections.json woes #829

@p0nce

Description

@p0nce

People seem confused by dub.selections.json on IRC.

<canidae> forgive my ignorance, but what's the point of dub.selections.json? i've specified a version in dub.json, why isn't this enough?
<canidae> perhaps there's a way to "disable" dub.selections.json?

In particular it is the 3rd time people ask how to get the latest tags in dependencies (I then advise to remove dub.selections.json + dub clean-caches).

=> dub upgrade is supposed to help but I guess it doesn't work everytime, which is something unrelated.

Honestly I somehow get why dub.selections.json and dub upgrade are there. But it is a bit backwards, it is more common to want the latest available version for everything (according to version selectors of course) that to want to stay on previous versions. If you want to pin dependencies into a specific version, you can always modify dub.json.

The other case I can think of is to pin the version of a sub-dependency, but the case is pretty rare. If a program with dependency A => B => C fail, it's quite easy to reproduce it with a program B => C. And committing dub.selections.json breaks the nice encapsulation of sub-dependencies DUB provides (A => B => C then A shouldn't know C).

Opinion: the cases where we do want dub.selections.json are a small minority.
I think it should be an opt-in choice. I remember a time where it wasn't there and never missed it.
In particular if a library pins dependencies instead of using SemVer, it creates diamond problems quickly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions