GNU bug report logs - #50349
[PATCH] packages: Add 'define-package' syntax.

Previous Next

Package: guix;

Reported by: Sarah Morgensen <iskarian <at> mgsn.dev>

Date: Fri, 3 Sep 2021 04:07:02 UTC

Severity: wishlist

Tags: patch

Merged with 15284

Full log


Message #14 received at 50349 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: Sarah Morgensen <iskarian <at> mgsn.dev>, 50349 <at> debbugs.gnu.org
Subject: Re: [bug#50349] [PATCH] packages: Add 'define-package' syntax.
Date: Sat, 04 Sep 2021 10:42:02 +0200
[Message part 1 (text/plain, inline)]
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 <at> gnu.org.

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 3 years and 281 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.