unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Xinglu Chen <public@yoctocell.xyz>
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: guix-devel@gnu.org
Subject: Re: Best practices for writing services
Date: Wed, 21 Apr 2021 12:45:21 +0200	[thread overview]
Message-ID: <87k0ov7w72.fsf@yoctocell.xyz> (raw)
In-Reply-To: <87wnswcmxi.fsf@gmail.com>

Hi,

On Tue, Apr 20 2021, Maxim Cournoyer wrote:

> That's a very good question, which I asked myself recently when
> attempting to write my first non-trivial service for Guix
> (jami-daemon-service-type).  I'd say 'define-configuration' is
> technically superior because of the automatic type checking it provides.
> It's also neat to be able to define the doc at one place and
> auto-generate it (although that's still manual for now).

You mean that one has to manually evaluate the ‘generate-documentation’
sexp and paste the output of it in the manual?  I thought it would
automatically update the manual when running ‘make’. ;)

> It has definitely been collecting some dust compared to the simpler
> approach using 'define-record-type*' directly, and the doc output it
> can generate doesn't match what is currently the norm in the manual,
> so it'd need a bit of a refresh.

Yeah, I noticed that some sections in the manual looked a bit different
than the rest.

One thing that I find a little annoying is that you have to specify a
default value for the fields.  This doesn’t make much sense in some
cases, e.g. there is no good default value for ‘user.name = NAME’ in the
Git config, the user should have to specify that themselves.

Another thing is that I don’t always want to “serialize-” the value for a
field, so I sometimes end up defining a bunch of dummy serializers that
just return an empty string.


  reply	other threads:[~2021-04-21 10:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 15:23 Best practices for writing services Xinglu Chen
2021-03-19 16:12 ` Joshua Branson
2021-03-19 17:01   ` Xinglu Chen
2021-04-21  3:54 ` Maxim Cournoyer
2021-04-21 10:45   ` Xinglu Chen [this message]
2021-04-21 18:05     ` Maxim Cournoyer
2021-04-22  7:27       ` Xinglu Chen
2021-04-23  4:42         ` Maxim Cournoyer
2021-04-23  6:04           ` Xinglu Chen
2021-04-21 22:10     ` raingloom
2021-04-22  7:19       ` Xinglu Chen
2021-04-26 20:29         ` raingloom

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=87k0ov7w72.fsf@yoctocell.xyz \
    --to=public@yoctocell.xyz \
    --cc=guix-devel@gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).