[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#53878] [PATCH v3 09/15] gnu: Add racket-vm-cgc.
From: |
Philip McGrath |
Subject: |
[bug#53878] [PATCH v3 09/15] gnu: Add racket-vm-cgc. |
Date: |
Wed, 23 Feb 2022 13:55:16 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 |
Hi,
On 2/20/22 13:13, Liliana Marie Prikler wrote:
Given Ludo’'s explanation, I think the difference (or at least an
important difference) is that those functions are defined in `(guix
...)` modules, as opposed to `(gnu packages ...)` modules.
But I wish I knew with any degree of certainty *why* this would be
true, if indeed it is.
Maybe Maxime knows?
Both Ludo and Maxime already explained this, but to be extra clear,
it's the thunking.
(define foo <something-in-bar.scm>)
(define bar <something-in-foo.scm>) <- problem
(define (foo) <something-in-bar.scm>)
(define bar <something-in-foo.scm>) <- no problem.
Since inputs are thunked, you can define chez in chez.scm and racket in
racket.scm and use them as input to each other without breaking the
compiler (you will break the package builder though). If you want
something more meaningful, you can define racket-minimal in racket.scm
and use it in chez.scm as input to a package, then use that package as
input to racket. This does not work for (source ) and (inherit )
however, because those forms are not thunked. You would have to thunk
them until you reach a save haven (like a package's inputs), where you
can call the thunk to produce a value.
To try to be concrete, I made the patch below as a mock-up of part of
your earlier suggestion (IIUC):
On 2/20/22 04:03, Liliana Marie Prikler wrote:
> Inside chez-and-racket-bootstrap, define (make-<package>) functions for
> the following:
> - chez-bootstrap-bootfiles, chez-for-racket-bootstrap-bootfiles:
> Taking version and origin.
> - racket-vm-cgc: Taking version and origin.
> - racket-vm-bc: Taking racket-vm-cgc.
> - racket-vm-cs: Taking racket-vm-bc.
>
...
>
> Inside racket, define %racket-version, %racket-origin, racket-minimal
> and racket. It'd also be good if you made local definitions
> (define racket-vm-cgc (make-racket-vm-cgc %racket-version %racket-
> origin))
> (define racket-vm-bc (make-racket-vm-bc racket-vm-cgc))
> ...
> in this file.
This applies on top of v4, or I've put it at
<https://gitlab.com/philip1/guix-patches/-/commit/982fe7cfb4d33103ee611acc310e3225ccf35852>
if that's easier for anyone:
--8<---------------cut here---------------start------------->8---
From 982fe7cfb4d33103ee611acc310e3225ccf35852 Mon Sep 17 00:00:00 2001
From: Philip McGrath <philip@philipmcgrath.com>
Date: Wed, 23 Feb 2022 11:13:43 -0500
Subject: [PATCH] example of import problems
---
gnu/packages/chez-and-racket-bootstrap.scm | 4 ++++
gnu/packages/racket.scm | 3 +++
2 files changed, 7 insertions(+)
diff --git a/gnu/packages/chez-and-racket-bootstrap.scm
b/gnu/packages/chez-and-racket-bootstrap.scm
index b779099fb3..ea10f7fe92 100644
--- a/gnu/packages/chez-and-racket-bootstrap.scm
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -47,6 +47,7 @@ (define-module (gnu packages chez-and-racket-bootstrap)
#:use-module ((guix licenses)
#:prefix license:)
#:export (chez-scheme-for-system
+ make-racket-vm-cgc
racket-vm-for-system))
;; Commentary:
@@ -199,6 +200,9 @@ (define-module (gnu packages chez-and-racket-bootstrap)
;;
;; Code:
+(define (make-racket-vm-cgc a b)
+ 42)
+
(define* (chez-scheme-for-system #:optional
(system (or (%current-target-system)
(%current-system))))
diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm
index c2854f84e8..08e437a722 100644
--- a/gnu/packages/racket.scm
+++ b/gnu/packages/racket.scm
@@ -58,6 +58,9 @@ (define %racket-version "8.4") ; MUST match
"chez-and-racket-bootstrap.scm"
(define %racket-commit
(string-append "v" %racket-version))
+(define fake-racket-vm-cgc
+ (make-racket-vm-cgc 1 2))
+
(define (extract-package-source origin spec)
"Extract the source for a Racket package specified by SPEC from
ORIGIN into
a new file-like object. In the resulting file-like object, the
package source
--
2.32.0
--8<---------------cut here---------------end--------------->8---
With this patch, trying to run `make` fails with the same kind of error
we've seen before:
```
ice-9/eval.scm:293:34: error: make-racket-vm-cgc: unbound variable
hint: Did you forget `(use-modules (gnu packages
chez-and-racket-bootstrap))'?
```
Overall, I certainly agree that duplicating the definition of
`%racket-version` is not ideal. I'd be glad for you or anyone to improve
the situation, and I'll try to get my head around Maxime's email about
the underlying semantics.
But I am confident that v4 of this series is at least not broken, if
perhaps not maximally beautiful. Especially given that I, for one, have
tried things that initially seemed correct only to discover subtle
problems later, I think it would be better for any refinements to come
in follow-on patches later.
-Philip
- [bug#53878] [PATCH v3 07/15] gnu: Add chez-nanopass., (continued)
- [bug#53878] [PATCH v3 07/15] gnu: Add chez-nanopass., Philip McGrath, 2022/02/19
- [bug#53878] [PATCH v3 12/15] gnu: Add racket-vm-cs., Philip McGrath, 2022/02/19
- [bug#53878] [PATCH v3 05/15] gnu: chez-scheme: Use new package style., Philip McGrath, 2022/02/19
- [bug#53878] [PATCH v3 09/15] gnu: Add racket-vm-cgc., Philip McGrath, 2022/02/19
- [bug#53878] [PATCH v3 09/15] gnu: Add racket-vm-cgc., Liliana Marie Prikler, 2022/02/19
- Message not available
- [bug#53878] [PATCH v3 09/15] gnu: Add racket-vm-cgc., Liliana Marie Prikler, 2022/02/20
- [bug#53878] [PATCH v3 09/15] gnu: Add racket-vm-cgc., Philip McGrath, 2022/02/20
- [bug#53878] [PATCH v3 09/15] gnu: Add racket-vm-cgc., Liliana Marie Prikler, 2022/02/20
- [bug#53878] [PATCH v3 09/15] gnu: Add racket-vm-cgc., Philip McGrath, 2022/02/20
- [bug#53878] [PATCH v3 09/15] gnu: Add racket-vm-cgc., Liliana Marie Prikler, 2022/02/20
- [bug#53878] [PATCH v3 09/15] gnu: Add racket-vm-cgc.,
Philip McGrath <=
- [bug#53878] [PATCH v3 09/15] gnu: Add racket-vm-cgc., Liliana Marie Prikler, 2022/02/23
- [bug#53878] [PATCH v3 09/15] gnu: Add racket-vm-cgc., zimoun, 2022/02/24
[bug#53878] [PATCH v3 11/15] gnu: Add chez-scheme-for-racket., Philip McGrath, 2022/02/19
[bug#53878] [PATCH v3 04/15] gnu: chez-and-racket-bootstrap: Add utilities for Chez machine types., Philip McGrath, 2022/02/19
[bug#53878] [PATCH v3 08/15] gnu: chez-scheme: Explicitly package bootstrap bootfiles., Philip McGrath, 2022/02/19
[bug#53878] [PATCH v3 13/15] gnu: chez-mit: Support chez-scheme-for-racket., Philip McGrath, 2022/02/19
[bug#53878] [PATCH v3 14/15] gnu: chez-and-racket-bootstrap: Add 'chez-scheme-for-system'., Philip McGrath, 2022/02/19
[bug#53878] [PATCH v3 15/15] gnu: racket: Update to 8.4., Philip McGrath, 2022/02/19
[bug#53878] Fwd: Re: [PATCH v3 14/15] gnu: chez-and-racket-bootstrap: Add 'chez-scheme-for-system'., Philip McGrath, 2022/02/19