Subject: [bug#49280] [PATCH v2 1/3] gnu: racket: Update to 8.2.

From: Leo Prikler <[email-masked]>
Date: Sun, 25 Jul 2021 15:03:35 +0200

Hi Philip,

Am Sonntag, den 25.07.2021, 04:22 -0400 schrieb Philip McGrath:
> The short answer is that I don't think including #f is causing any 
> problems, whereas trying not to include it seems likely to cause a 
> variety of problems.

That short explanation imo doesn't adequately summarize the long one. 
Rest assured, the long explanation gives us a good reason to use #f as
you did, it's just that the way to reach this point of understanding
appears a bit of a long one.

> I'll try to explain more clearly.
> 
> It might be more useful to look at the second patch in the series,
> which 
> uses the "extend-layer.rkt" script to generate a "config.rkt" file
> for 
> the `racket` package, and especially the third patch, which replaces 
> this code completely for the `racket-minimal` package:
> 
> On 7/19/21 2:31 AM, Philip McGrath wrote:
> > +         (add-before 'configure 'initialize-config.rktd
> >              (lambda* (#:key inputs #:allow-other-keys)
> > -             (chdir "src")
> > +             (define (write-racket-hash alist)
> > +               ;; inside must use dotted pair notation
> > +               (display "#hash(")
> > +               (for-each (match-lambda
> > +                           ((k . v)
> > +                            (format #t "(~s . ~s)" k v)))
> > +                         alist)
> > +               (display ")\n"))
> > +             (mkdir-p "racket/etc")
> > +             (with-output-to-file "racket/etc/config.rktd"
> > +               (lambda ()
> > +                 (write-racket-hash
> > +                  `((lib-search-dirs
> > +                     . (#f ,@(map (lambda (lib)
> > +                                    (string-append (assoc-ref
> > inputs 
> lib)
> > +                                                   "/lib"))
> > +                                  '("openssl"
> > +                                    "sqlite"))))
> > +                    (catalogs
> > +                     . (,(string-append
> > +                          "
> > https://download.racket-lang.org/releases/"
> > +                          ,version
> > +                          "/catalog/")
> > +                        #f))))))
> >                #t))
This is perhaps a somewhat noobish question, but why must we use dotted
pair notation here?  To me personally, reading '(a . (b c)) is
confusing as it could more clearly be written as '(a b c).  Is this a
Racket convention?

> This code creates a template "config.rktd" file used in the build 
> process: the distributed source tarballs contain such a template 
> already, which is why we didn't need explicitly configure `catalogs`
> to add the release-pinned package catalog until this change. It is
> added before the `#f` so that the release catalog is checked before
> the default catalogs (which point to the latest sources). For 
> `lib-search-dirs`, on the other hand, we want Racket-specific
> library paths to be tried first, and indeed for layers of a Racket
> installation to be searched in order, so `#f` is at the head of the
> list.
> 
> The Racket build process extends the template "config.rktd" file
> based on build options like the `--prefix` passed to `configure`. For
> example, it configures `lib-dir` to "lib/racket" within the store
> output directory. (It would be incorrect to set those values in the
> template "config.rktd" file because it is used in the build process
> before installation.)
> 
> The `#f` entry in `lib-search-dirs` is usually replaced by a 
> user-specific path like "/home/philip/.local/share/racket/8.1/lib"
> and the installation-wide path specified by the `lib-dir` key, unless
> one or both are changed. Omitting the `#f` entry means that neither
> of paths are ever included. I don't know of any real-life
> circumstance in which one would want such a "config.rktd" file. In
> particular, missing `#f` entries creates problems for layered
> installations, which use these search paths to find earlier layers.
> 
> There are some other configuration possibilities we may want to
> explore as Guix's support for Racket packages improves, such as
> "addon" tethering and customizing the "installation name" or "build
> stamp". However, this patch series does not attempt to change how
> Guix's Racket packages work, other than correcting the error I
> introduced in <https://issues.guix.gnu.org/47180>;. Racket installed
> via Guix has the same behavior in this respect as Racket installed
> via Debian or other package managers, and that's a way of using
> Racket I think Guix will want to continue to support.
To attempt a better summary: Specifying `#f' will allow Racket to
search for user-specific libraries etc. (in
$XDG_DATA_HOME/racket/$RACKET_VERSION) in addition to "system-specific" 
libraries stored in $HOME/.guix-profile, am I correct?

If so, then yes, doing that is absolutely fine (you could compare it to
how Emacs users can still install stuff via ELPA).

Regards,