[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#50349] [PATCH] packages: Add 'define-package' syntax.
From: |
Maxime Devos |
Subject: |
[bug#50349] [PATCH] packages: Add 'define-package' syntax. |
Date: |
Sat, 04 Sep 2021 10:42:02 +0200 |
User-agent: |
Evolution 3.34.2 |
Sarah Morgensen schreef op do 02-09-2021 om 21:06 [-0700]:
> Hello Guix,
>
> This patch adds a shorthand for "(define-public name (package ...))":
>
> (define-package my-favorite-package
> (name "my-favorite-package")
> ...)
This could be even shorter in the special case that the variable name
and package name are the same (modulo types):
(define-package "my-favorite-package"
(version ...)
...)
'datum->syntax' and 'string->symbol' can be used to turn "my-favorite-package"
into an identifier.
A 'define-unexported-package' might be required in some places.
> The purpose is primarily to save the horizontal indent, but IMO it looks
> better, and is marginally more clear for newcomers. I think ideally we could
> eventually transition to using this syntax as the primary syntax and only use
> 'define-public' when necessary.
>
> There are some downsides... it's one more form to keep track of, and 'let'
> forms can't easily be used with it.
>
> Since it's a syntax rule, it doesn't cause packages to rebuild (tested). I've
> also tested the indentation rules, indent-code.el, and the snippets.
>
> This probably deserves a documentation addition, but I wasn't sure where to
> add it without confusing newcomers. Suggestions welcome!
‘Defining Packages’ would be a good place I think.
> What do you all think?
This looks nice to me. IIUC, the define-package is intended to be clearer
to newcomers, so you might want to ask for feedback on the new syntax on
help-guix@gnu.org.
Greetings,
Maxime.
signature.asc
Description: This is a digitally signed message part