all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: iyzsong@member.fsf.org (宋文武)
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: Ricardo Wurmus <rekado@elephly.net>, 27155@debbugs.gnu.org
Subject: [bug#27155] [PATCH 0/2] Support service extensions on the "final" service values
Date: Fri, 16 Jun 2017 01:12:15 +0800	[thread overview]
Message-ID: <87mv99rx8w.fsf@member.fsf.org> (raw)
In-Reply-To: <87bmq07m0y.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Wed, 07 Jun 2017 01:07:41 +0200")

ludo@gnu.org (Ludovic Courtès) writes:

> Hi Ricardo,
>
> Ricardo Wurmus <rekado@elephly.net> skribis:
>
>> I think it is useful to have the ability to add rewriters at the end of
>> service composition.  In my opinion it is always good to have an escape
>> hatch, and this seems to fit the bill.  But I agree that it is not
>> an elegant solution, and I wouldn’t want to advocate using it.
>
> Right.  As discussed on IRC, one problem is ordering: if there are
> several users of this features for a given service, you can’t really
> tell what’s going to happen, unless the modifications happen to be
> commutable.
>
>> As to your second idea: it seems tedious for service writers to have to
>> anticipate the ways in which services could be extended (here given by
>> providing extension points).
>
> Boilerplate aside, I’m not sure it would be this tedious.
>
>> Would it make more sense to allow *extensions* to specify how they
>> should be applied rather than letting services define extension points?
>> This would shift the burden away from services to service extensions.
>> Extensions would still need to provide a way of extending the parent
>> service, but this could be optional.
>
> What would it look like?

Maybe allow a service to override extensions specified by its
type?

It can be:
--8<---------------cut here---------------start------------->8---
(define etc-service-type
  (service-type
    (name 'etc)
    (default-extensions (list ...))
    (extension-points (list ...))))

(define builtin-etc-service
  (... %base-services))

(define my-etc-service
  (service etc-service-type
    (service-value builtin-etc-service)
    #:extensions
    (list (service-extension
            activation-service-type
            activate-my-etc-files-in-my-way)
          ...)))
--8<---------------cut here---------------end--------------->8---

So we can change what service actually do, this is really powerful!

  reply	other threads:[~2017-06-15 17:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-30 21:58 bug#27155: [PATCH 0/2] Support service extensions on the "final" service values Ludovic Courtès
2017-05-30 22:05 ` bug#27155: [PATCH 1/2] DRAFT services: Extensions can specify a "finalization" procedure Ludovic Courtès
2017-05-30 22:05   ` bug#27155: [PATCH 2/2] system: pam: Remove custom API to transform PAM services Ludovic Courtès
2017-06-01  9:57 ` bug#27155: [PATCH 0/2] Support service extensions on the "final" service values Alex Kost
2017-06-01 11:24   ` Ludovic Courtès
2017-06-03 21:21 ` Ludovic Courtès
2017-06-04 14:26   ` Alex Kost
2017-06-05 10:06     ` Ludovic Courtès
2017-06-05 12:52 ` Ricardo Wurmus
2017-06-06 23:07   ` Ludovic Courtès
2017-06-15 17:12     ` 宋文武 [this message]
2017-06-21 13:06       ` [bug#27155] " Ludovic Courtès

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=87mv99rx8w.fsf@member.fsf.org \
    --to=iyzsong@member.fsf.org \
    --cc=27155@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    --cc=rekado@elephly.net \
    /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.