[Top][All Lists]

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

Re: reader macros for hidden packages

From: jgart
Subject: Re: reader macros for hidden packages
Date: Sun, 26 Jun 2022 09:43:33 -0500

On Sun, 26 Jun 2022 09:27:15 +0200 Maxime Devos <> wrote:
> 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.

I've tried reading that code. Looking to get back to it again soon. gexps
are still somewhat fuzzy for me. Atleast at the implementationn level.

> Also, @hidden does not start with #, 

I was inspired by this common lisp code using cl-syntax-annot:

>so you can't extend the read
> syntax that wat with read-hash-extend. (I suppose  you could go #hidden
> instead).

Does read-hash-extend allow for more than a single character after the hash # 

>From reading the docs it looked like not... I'll spend some more repl time 
>with it.

Just for the sake of hacking. I'm finding excuses to write guile that I
wouldn't normally write and to explore hacking on guix APIs to see what
I can mold them too.

Take this exploration with goops and guix for example:

> Or a new 'define-public-hidden':
> (define-public-hidden python-httplib2
>   (package
>     (name "...")
>     ...))

I like this idea. You'd implement that as a macro that inserts hidden-package 
for the user of define-public-hidden?

> or move the relevant packages upstream?  

Yup, that's the next step. Was just trying to find a way to suppress
warnings until I have time to upstream the relevant packages and to hack
me some guile for fun.

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

Thanks for all the advice. It's much appreciated!

all best,


reply via email to

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