On Mon, Jun 7, 2021 at 1:46 PM Don Green <infodeveloper...@gmail.com> wrote:
> Following from Philip's 3rd point, which I think is very relevant, I > surmise that I really should: > 1) build libraries ;that reference my code (These libraries are built > within a user-defined package.) > This seems right, though I would say that the libraries will be your code. > 2) Then my initial question, refined, becomes: > Can a new user defined library encompass nothing more than references to > previous user defined libraries? (I think the answer is: yes). > Yes. > 3) Since the library is said to be referenced through their > collection-based paths this leads me to wonder: > Am I expected to create my own pathed-collection that gives my code > independence from the default installled racket pathed-collections? > > Then am I to use: (current-library-collection-links paths) to link my > collection into the racket system? > It is exceedingly unlikely that using `current-library-collection-links` is what you want. I would go so far as to say that you should not need to use any feature relating to collection links in normal use of Racket: those features are really for tinkering under the hood with new ways of building and installing Racket. I'm going to try to offer some concrete advice, with a lot of assumptions—they may be wrong, but perhaps laying them out will highlight anything I've missed. Given that you've mentioned the path "/home/don/.plt-scheme/4.2.1/collects", it sounds like you have some code that predates Racket's package system. The right thing to do is to turn that code into a package and install it. (Note that, in Racket, making something a package doesn't mean publishing it. It may exist only as a directory on your local file system.) Let's assume you have your code in paths like "/home/don/.plt-scheme/4.2.1/collects/tic-tac-toe" and "/home/don/.plt-scheme/4.2.1/collects/tetris". Make a new directory "/home/don/my-first-racket-package" and copy your code from "/home/don/.plt-scheme/4.2.1/collects" there. Create a file "/home/don/my-first-racket-package/info.rkt" with contents like this: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #lang info (define pkg-name "my-first-racket-package") (define collection 'multi) (define pkg-desc "My first Racket package") (define version "0.0") (define pkg-authors '(don)) (define deps '("base")) (define build-deps '()) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; At this point, you should have a directory structure like this: - /home/don/my-first-racket-package/ - info.rkt - tetris/ - … various files and directories … - tic-tac-toe/ - … various files and directories … An important caveat: for simplicity, I've assumed your code in "/home/don/.plt-scheme/4.2.1/collects" is not intermingled with the default collections of minimal Racket. If they are mixed up, copy only your files. (Corresponding collection directories will effectively be merged.) Then, install your new package. You should not need to set any environment variables or change anything in "config.rktd": indeed, it would be best if you do not. You may want to uninstall and replace your system Racket installation to get a clean configuration. To install the package, run: cd /home/don/my-first-racket-package/ && raco pkg install If your code uses functionality outside of minimal Racket, you may get a warning about missing dependencies. Running: raco setup --fix-pkg-deps my-first-racket-package will attempt to add the necessary declarations to your "info.rkt" file. In the future, you can run: raco setup my-first-racket-package to recompile all the code in your package. You can run these `raco setup` commands regardless of your current working directory. I hope this helps! -Philip -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/01000179e7db69dd-946513ef-9a47-437b-88eb-6655396b83ac-000000%40email.amazonses.com.