librelist archives

« back to archive

Ordering issues with :repositories

Ordering issues with :repositories

From:
Phil Hagelberg
Date:
2012-08-17 @ 22:41
Hello folks.

There are currently some issues with :repositories that I want to
address in the next preview. It used to use a regular Clojure map,
which was very bad because Clojure silently changes maps from
ArrayMaps (which preserve order) to HashMaps (which do not) above a
certain size. So you could get nondeterministic results. Recently
we've switched to using ordered maps from the ordered library
(https://github.com/flatland/ordered), but this causes problems if you
want to read the project map from a process that doesn't have the
ordered dependency.

One solution discussed was to switch to using a vector of maps instead
of a map. We would still accept maps, and any single :repositories map
being read would still run the risk of becoming unordered (which we
can't really do anything about).

The question here is whether this would break any existing plugins
that rely on :repositories being a map. If you know of any such
plugin, please speak up!

thanks,
Phil

Re: Ordering issues with :repositories

From:
Phil Hagelberg
Date:
2012-08-25 @ 00:37
Phil Hagelberg <phil@hagelb.org> writes:

> One solution discussed was to switch to using a vector of maps instead
> of a map. We would still accept maps, and any single :repositories map
> being read would still run the risk of becoming unordered (which we
> can't really do anything about).

For the record, the solution we ended up with in 2.0.0-preview9 was to
switch to a vector of [id {:url url}] vectors because this is very close
to the old format of using a map; in fact if you end up calling seq on
it then it's exactly the same. The only place you'll notice a difference
is if you try to call get or the equivalent on :repositories.

-Phil

Re: Ordering issues with :repositories

From:
Tassilo Horn
Date:
2012-08-25 @ 07:24
Phil Hagelberg <phil@hagelb.org> writes:

Hi Phil,

>> One solution discussed was to switch to using a vector of maps
>> instead of a map. We would still accept maps, and any single
>> :repositories map being read would still run the risk of becoming
>> unordered (which we can't really do anything about).
>
> For the record, the solution we ended up with in 2.0.0-preview9 was to
> switch to a vector of [id {:url url}] vectors because this is very
> close to the old format of using a map;

Awesome, my leiningen plugin works again. :-)

Thanks,
Tassilo