[racket-dev] `collection-path' Considered Brittle

From: Vincent St-Amour (stamourv at ccs.neu.edu)
Date: Mon Nov 4 12:45:16 EST 2013

While looking at Asumu's `raco-find-collection' package, Asumu and I
noticed something about the `collection-path' function that made us
uncomfortable.

`collection-path' returns *a* path where the given collection is
located. With the package system, there can now be *multiple* such
paths. `collection-path' returns the first one (in alphabetical order of
package name, at first glance).

This means that installing a package that extends collection `foo' can
break code that uses `(collection-path "foo")'.

For an example that's currently broken, what used to be an arrow in the
macro stepper window is now a box with an X in it. The macro stepper
looks for that arrow in the `icons' collection, which is now split
between two packages. `collection-path' returns the path from the
package that doesn't contain that arrow.


A solution would be to provide a `collection-paths' function, that
returns *all* the relevant paths, and add a big warning to the
documentation of `collection-path'. A `collection-paths' function
already exists in
`pkgs/compiler-pkgs/compiler-lib/compiler/commands/test.rkt'.


Vincent

Posted on the dev mailing list.