all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: Sarah Morgensen <iskarian@mgsn.dev>, 50349@debbugs.gnu.org
Subject: [bug#50349] [PATCH] packages: Add 'define-package' syntax.
Date: Sat, 04 Sep 2021 10:42:02 +0200	[thread overview]
Message-ID: <757b7543b931335c3725264edfbc79c012aa10fc.camel@telenet.be> (raw)
In-Reply-To: <15d01b32313f5f2f291b120597719ae92bd26acd.1630639896.git.iskarian@mgsn.dev>

[-- Attachment #1: Type: text/plain, Size: 1573 bytes --]

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.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

  parent reply	other threads:[~2021-09-04  8:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03  4:06 [bug#50349] [PATCH] packages: Add 'define-package' syntax Sarah Morgensen
2021-09-03  5:41 ` zimoun
2021-09-03 21:56 ` Sarah Morgensen
2021-09-04  8:42 ` Maxime Devos [this message]
2021-09-04 10:09   ` bug#50349: " Tobias Geerinckx-Rice via Bug reports for GNU Guix
2021-09-04 14:29     ` Taylan Kammer
2021-09-04 14:44       ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2021-09-04 17:23         ` Taylan Kammer
2021-09-04 18:53           ` Sarah Morgensen
2021-09-04 21:01             ` Taylan Kammer
2021-09-04 23:17   ` Sarah Morgensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=757b7543b931335c3725264edfbc79c012aa10fc.camel@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=50349@debbugs.gnu.org \
    --cc=iskarian@mgsn.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.