[racket] raco exe and collection path

From: Sam Tobin-Hochstadt (samth at cs.indiana.edu)
Date: Tue Oct 22 21:19:09 EDT 2013

On Tue, Oct 22, 2013 at 8:54 PM, Erik Pearson <erik at adaptations.com> wrote:
> Thanks.
>
> raco link -d <collections-dir> is working, that is, my collections are
> found, although I still have one little problem. The precedence of my linked
> collection directory seems to be lower than for the built-in collections.
> With the explicit collections directory setting in drracket I'm able to set
> the github directory higher, which allows me to shadow built-in collections.
> Now my code is loading the built in collection, rather than the replacement
> I'm using.
>
> A workaround could be to rename the replacement collection (net), which is
> not a big deal, but inconvenient.
>
> Please let me know if I'm wrong about this. Otherwise, is there a
> recommended way to shadow a system collection?

One question: are you replacing actual system libraries, or just
adding new things to, for example, the `net` collection?

If you're just adding `net/quic` or something like that, then the
precedence shouldn't matter.

If you're actually _replacing_ something like `net/url`, then that's
more worrying, because it will potentially cause parts of Racket to
break.

Sam

>
> Thanks, Erik.
>
>
> On Tue, Oct 22, 2013 at 4:42 PM, Sam Tobin-Hochstadt <samth at cs.indiana.edu>
> wrote:
>>
>> On Tue, Oct 22, 2013 at 7:36 PM, Greg Hendershott
>> <greghendershott at gmail.com> wrote:
>> > I think the equivalent to DrRacket's Collection Paths setting might be
>> > to use the PLTCOLLECTS environment variable? See:
>> >
>> >     http://docs.racket-lang.org/reference/collects.html
>> >
>> > Also there are a number of command-line flags; I'm not sure which
>> > corresponds to exactly what you need:
>> >
>> > $ racket -h
>> > ...
>> >   -X <dir>, --collects <dir> : Main collects at <dir> (or "" disables
>> > all)
>> >   -S <dir>, --search <dir> : More collects at <dir> (after main
>> > collects)
>> >   -A <dir>, --addon <dir> : Addon directory at <dir>
>> >   -R <paths>, --compiled <paths> : Set compiled-file search roots to
>> > <paths>
>> >   -C <file>, --links <file> : User-specific collection links at <file>
>> > ...
>>
>> `-S` is the one that's like `PLTCOLLECTS`.
>>
>> But more generally, I would strongly encourage Erik (and others) not
>> to use PLTCOLLECTS or its analogues, but instead to use the package
>> system (or `raco link`).
>>
>> `raco link` is probably the simplest thing to do here, like so:
>>
>>     raco link -d /home/epearson/work/racket/github
>>
>> That should set up all the collections you have.
>>
>> Better still would be to set up a package, even one locally that you
>> don't distribute.
>>
>> Sam
>>
>>
>> >
>> > On Tue, Oct 22, 2013 at 4:39 PM, Erik Pearson <erik at adaptations.com>
>> > wrote:
>> >> Hi,
>> >> I've just switched over to the Racket github master from 5.3.6. It is
>> >> set up
>> >> well enough that development proceeds normally. I have setup a
>> >> collection
>> >> directory which contains libraries that I'm developing and upon which
>> >> my
>> >> main projects depend. For DrRacket work I have used Language -> Choose
>> >> Language ... -> Collection Paths to set this up, putting my collection
>> >> path
>> >> at the top so that it can override the system path if it needs to.
>> >> Works
>> >> great.
>> >>
>> >> But this Collection Paths setting does not seem to be honored by Racket
>> >> ->
>> >> Create Executable. Similarly from the command line raco exe does not
>> >> seem to
>> >> be using these preferences, nor can I figure out how to tell raco to
>> >> use my
>> >> collection directory.
>> >>
>> >> The specific error message I am getting is:
>> >>
>> >> /home/epearson/work/racket/coco/scgi-server.rkt:4:8: collection not
>> >> found
>> >>   for module path: (lib "racqueb/scgi2")
>> >>   collection: "racqueb"
>> >>   in collection directories:
>> >>    /home/epearson/.racket/development/collects
>> >>    /home/epearson/work/racket/plt/plt/racket/collects
>> >>   context...:
>> >>    show-collection-err
>> >>    standard-module-name-resolver
>> >>    standard-module-name-resolver
>> >>
>> >>
>> >> /home/epearson/work/racket/plt/plt/racket/collects/compiler/embed.rkt:394:0:
>> >> get-code
>> >>
>> >>
>> >> /home/epearson/work/racket/plt/plt/racket/collects/compiler/embed.rkt:993:0:
>> >> do-write-module-bundle
>> >>
>> >>
>> >> /home/epearson/work/racket/plt/plt/racket/collects/compiler/embed.rkt:1517:51
>> >>
>> >>
>> >> /home/epearson/work/racket/plt/plt/racket/collects/compiler/private/elf.rkt:190:6:
>> >> temp19
>> >>
>> >> As you can see, is using the default collection paths, and not the one
>> >> that
>> >> I've added via DrRacket preferences, which would be
>> >> /home/epearson/work/racket/github.
>> >>
>> >> So, the question is -- first, I guess this might be considered a bug in
>> >> DrRacket -- since Create Executable is not using the same collection
>> >> paths
>> >> as the IDE? Second, is there a way to supply raco exe and distribute
>> >> with a
>> >> new collection path? Ideally I would just supply a new one which is
>> >> added to
>> >> the top of the path list, but I could also just reconstruct the
>> >> collection
>> >> path list from scratch if need be. (The docs for
>> >> create-embedding-executable
>> >> imply this.)
>> >>
>> >> (BTW I'm not implying that anything has changed in this regard from
>> >> 5.3.6.
>> >> In 5.3.6 I had used links to the individual libraries, but in github
>> >> master
>> >> I had switched to using the collection paths, which is less maintenance
>> >> and
>> >> allows seamless shadowing of system libraries with custom
>> >> replacements.)
>> >>
>> >> Thanks,
>> >> Erik.
>> >>
>> >>
>> >> ____________________
>> >>   Racket Users list:
>> >>   http://lists.racket-lang.org/users
>> >>
>> > ____________________
>> >   Racket Users list:
>> >   http://lists.racket-lang.org/users
>
>
>
>
> --
> Erik Pearson
> Adaptations
> ;; web form and function

Posted on the users mailing list.