[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Philip McGrath
Subject: [bug#49280] [PATCH v2 1/3] gnu: racket: Update to 8.2.
Date: Sun, 25 Jul 2021 14:04:35 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0


On 7/25/21 9:03 AM, Leo Prikler wrote:
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
+                                                   "/lib"))
+                                  '("openssl"
+                                    "sqlite"))))
+                    (catalogs
+                     . (,(string-append
+                          "";
+                          ,version
+                          "/catalog/")
+                        #f))))))
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?

Yes, the Racket reader requires that hash table literals use dotted pair notation, e.g. #hash((a . (b c))(d . 2)). (Additionally, hand-written Racket would often use square brackets for the key–value pairs.) I think it's ultimately for historical reasons, but there are various subtleties: under `quasiquote`, for example, the value position can contain `unquote`, but the key position cannot.

Of course, that doesn't necessarily mean the Guile code must use dotted pairs, but, at least as a Racketeer, I found writing these s-expressions with a bit of a "Racket accent" helped me to remember that this code is generating Racket.

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).

Yes, that's a much better summary.

(Pedantically, the user-specific path could be different, depending on the configured installation name and other things.)

The other issue is that I believe *not* specifying `#f` for `racket-minimal` would break the build of `racket` starting in the second patch, when the main distribution becomes a layer chaining to `racket-minimal`. At least, it broke some examples of layered installation I tried, which is how I figured out I'd done the wrong thing in <>. If that were the only issue, there might be some other workaround, but it's worth bearing in mind, particularly because the problems caused by buggy "config.rktd" files can be subtle and easy to miss.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]