Imports with versions

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Oct 30 13:02:00 PDT 2012


On Tue, Oct 30, 2012 at 07:42:13PM +0100, Paulo Pinto wrote:
> On Tuesday, 30 October 2012 at 15:00:03 UTC, Jacob Carlborg wrote:
> >On 2012-10-30 13:25, Paulo Pinto wrote:
> >>.NET and OSGi are similar approaches, because they rely on
> >>dynamic linking.
> >>
> >>The package manager only works with static linking, otherwise you
> >>might get into the situation it compiles fine, but runs into version
> >>conflicts when running. Common scenario to anyone doing Java
> >>development.
> >
> >I would say, in this case, that you haven't specified the versions
> >correctly.
> 
> Not really.
> 
> Let's say you compile everything fine, but on the deployment platform,
> some IT guy has the cool idea of changing some configuration settings.
> 
> That change will have as side effect that some third party
> dependencies will now be matched to another version different than
> what was used by the package manager.

But doesn't that mean the version wasn't correctly depended upon?

There should NEVER be generic dynamic library dependencies (i.e., "I can
link with any version of libc"), because they are almost always wrong in
some way. Maybe not obvious at first, but still wrong. They should
always depend on the *exact* version (or versions) of a library.
Anything else is fundamentally broken and will eventually cause
headaches and sleepless nights.

Mind you, though, a lot of libraries have a totally broken versioning
system. Many library authors believe that the version only needs to be
bumped when the API changes. Or worse, only when the existing API
changes (new parts of the API are discounted.) That is actually wrong.
The version needs to be bumped every time the *ABI* changes. An ABI
change can include such things as compiling with different flags, or
with a different compiler (*cough*gdc*dmd*cough*), *even when the source
code hasn't been touched*. Any library that breaks this rule is
essentially impossible to work with, because there is no way to
guarantee that what gets linked at runtime is actually what you think it
is.

Unfortunately, in practice, both of the above are broken repeatedly.


T

-- 
We've all heard that a million monkeys banging on a million typewriters
will eventually reproduce the entire works of Shakespeare.  Now, thanks
to the Internet, we know this is not true. -- Robert Wilensk


More information about the Digitalmars-d mailing list