Subject: [bug#57050] [PATCH v2 04/13] gnu: Add Zuo.

From: "Philip McGrath" <[email-masked]>
Date: Thu, 11 Aug 2022 10:00:52 -0400

Hi,

On Thu, Aug 11, 2022, at 7:31 AM, Liliana Marie Prikler wrote:
> Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip McGrath:
>> [...]
>>  
>>  (define %racket-version "8.5") ; Remember to update chez-scheme-for-
>> racket!
>> +(define %zuo-version "1.0") ; defined in racket/src/zuo/zuo.c
> Is that publicly visible?

For example:

    echo "#lang zuo (hash-ref (runtime-env) 'version)" | zuo ""

See also https://racket.discourse.group/t/writing-the-zuo-version-number/1105

I likewise have comments in the definitions of 'chez-scheme' and 'chez-scheme-for-racket' explaining where in the source code to find the version number.

>> +
>> +(define-public zuo
>> +  (let ((revision #f))
>> +    (package
>> +      (name "zuo")
>> +      (version (string-append %zuo-version
>> +                              "-racket"
>> +                              "8.6"
>> +                              (if revision "-guix" "")
>> +                              (or revision "")))
> Is this really needed?  If we expect to maintain zuo split from racket,
> I'd rather go with https://github.com/racket/zuo and git-version.

I mean, I don't think it's profoundly essential, but I've been using it for the last four months. I don't see any harm in leaving the level of indentation there so it can be used more easily if it is needed or wanted.

Building from https://github.com/racket/zuo would basically never be useful. It is generated intermittently from https://github.com/racket/racket using `git subtree`.

>> +         (file-name (git-file-name "racket" "8.6"))))
>> +      (outputs '("out" "debug"))
>> +      (build-system gnu-build-system)
>> +      (inputs (list bash-minimal))
>> +      (native-inputs (list bash-minimal))
>> +      (arguments
>> +       (list
>> +        #:configure-flags
>> +        #~`(,(string-append "CPPFLAGS=-DGUIX_RKTIO_BIN_SH="
>> +                            #$(file-append (this-package-input
>> "bash-minimal")
>> +                                           "/bin/sh"))
> As with chez-scheme, I do think using a Racket-agnostic macro name is
> helpful here.

I'm planning to respond in the other thread about the possibility of a truly generic macro name, but I hope it doesn't need to become an issue blocking this patch series. For now, I'm not entirely sure what "Racket-agnostic" means; the bottom line for my is I think it would be absurdly awful to have to write, e.g. if cross-compiling using `distro-build` with the top-level Makefile:

    ./configure CPPFLAGS="GUIX_RKTIO_BIN_SH=/input/bin/sh GUIX_ZUO_BIN_SH=/input/bin/sh GUIX_CHEZ_BIN_SH=/input/bin/sh" CPPFLAGS_FOR_BUILD="GUIX_RKTIO_BIN_SH=/native-input/bin/sh GUIX_ZUO_BIN_SH=/native-input/bin/sh GUIX_CHEZ_BIN_SH=/native-input/bin/sh"

>> +      (home-page "https://github.com/racket/zuo")
>> +      ;; ^ This is downstream of https://github.com/racket/racket,
>> +      ;; but it's designed to be a friendly landing place
>> +      (synopsis "Tiny Racket for build scripts")
>> +      (description "You should use Racket to write scripts.
> Sorry, but I prefer Guile.

(At the risk of responding seriously to what was probably meant to be a joke:) I've never tried to use Guile on Windows, but, given that the manual chapter is called "POSIX System Calls and Networking", it's not clear to me that Guile provides as portable and powerful "primitives for dealing with files and running processes" as Zuo, let alone Racket.

>
>>   But what if you
>> +need something much smaller than Racket for some reason—or what if
>> you're
>> +trying to script a build of Racket itself?  Zuo is a tiny Racket
>> with
>> +primitives for dealing with files and running processes, and it
>> comes with a
>> +@command{make}-like embedded DSL.
>> +
>> +Zuo (作) is a Racket variant in the sense that program files start
>> with
>> +@code{#lang}, and the module path after @code{#lang} determines the
>> parsing
>> +and expansion of the file content.  That's how the @command{make}-
>> like DSL is
>> +defined, and even the base Zuo language is defined by layers of
>> @code{#lang}s.
>> +One of the early layers implements macros.")
>> +      (license (list license:asl2.0 license:expat)))))
> Rarely have I read a description this long, yet uninformative.  Let me
> shorten that a little: "Zuo is a tiny Racket variant that can be used
> to bootstrap Racket.  It comes with primitives for dealing with files
> and processes, as well as a @command{make}-like DSL."
>

This is the description from the Zuo documentation and readme file. I find your shortened version less clear than the original. The details about `#lang` as a Racketeer are important to understand in what sense Zuo is a "Racket variant", given that it is not currently possible to run `#lang zuo` programs using the `racket` executable. (IIUC someone is working on a Racket package implementing `#lang zuo/kernel`, at which point that will change.) I also think "can be used to bootstrap Racket" greatly underplays the potential of Zuo. A number people have already taken an interest in or started experimenting with Zuo outside of building Racket.

-Philip