guix-devel
[Top][All Lists]
Advanced

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

Re: reader macros for hidden packages


From: Maxime Devos
Subject: Re: reader macros for hidden packages
Date: Sun, 26 Jun 2022 09:27:15 +0200
User-agent: Evolution 3.38.3-1

jgart schreef op za 25-06-2022 om 22:27 [-0500]:
> Out of curiosity, is it possible to make reader macros like this with guile?
> 
> ```
> @hidden
> (define-public python-httplib2
>   (package
>     (name "python-httplib2")
> [...]
> The above would make the package hidden by using `hidden-package`.

FWIW, read-hash-extend things aren't macros, though that can be worked
around with some cleverness, see (guix gexp) where #~(...) -> (gexp
...) by the read syntax, and 'gexp' is a macro.

Also, @hidden does not start with #, so you can't extend the read
syntax that wat with read-hash-extend. (I suppose  you could go #hidden
instead).

However, I cannot recommend this, for read syntax is global (not per
module, like the module system) and there can only be a single read
syntax per first character (so high chance for collisions).

It's also rather magical, and we already have the less magical but no
less concise 'hidden-package', why not:

(define-public python-httplib2
  (hidden-package
    (name "...")
    ...))

Or a new 'define-public-hidden':

(define-public-hidden python-httplib2
  (package
    (name "...")
    ...))

or move the relevant packages upstream?  Also, the module system has a
#:replace, which may be useful to put in the (guixrus packages ...)
modules such that in case a module imports both the guixrus and guix
module, the guixrus wins (not 100% sure if that would works).

Greetings,
Maxime.

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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