all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Incorrect service documentation?
@ 2018-03-23 10:09 Chris Marusich
  2018-03-26 12:57 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Marusich @ 2018-03-23 10:09 UTC (permalink / raw)
  To: guix-devel

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

Hi,

The manual ((guix) Service Reference) reads:

 -- Data Type: service-type
     This is the representation of a “service type” (*note Service Types
     and Services::).

     ‘name’
          This is a symbol, used only to simplify inspection and
          debugging.

     ‘extensions’
          A non-empty list of ‘<service-extension>’ objects (see below).

     ‘compose’ (default: ‘#f’)
          If this is ‘#f’, then the service type denotes services that
          cannot be extended—i.e., services that do not receive “values”
          from other services.

          Otherwise, it must be a one-argument procedure.  The procedure
          is called by ‘fold-services’ and is passed a list of values
          collected from extensions.  It must return a value that is a
          valid parameter value for the service instance.

     ‘extend’ (default: ‘#f’)
          If this is ‘#f’, services of this type cannot be extended.

          Otherwise, it must be a two-argument procedure:
          ‘fold-services’ calls it, passing it the initial value of the
          service as the first argument and the result of applying
          ‘compose’ to the extension values as the second argument.

Is the description of "compose" correct?  The manual claims that it
"must return a value that is a valid parameter value for the service
instance," but I do not think that is actually true.  Judging by the
implementation of fold-services in (gnu services), it may return any
single value as long as the extend procedure knows how to handle it.  In
fact, it is the "extend" procedure which must return a valid parameter
value for the service.

If this is true, then I suggest we change the documentation as follows:

     ‘compose’ (default: ‘#f’)
          If this is ‘#f’, then the service type denotes services that
          cannot be extended—i.e., services that do not receive “values”
          from other services.

          Otherwise, it must be a one-argument procedure.  The procedure
          is called by ‘fold-services’ and is passed a list of values
          collected from extensions.  It may return any single value.

     ‘extend’ (default: ‘#f’)
          If this is ‘#f’, services of this type cannot be extended.

          Otherwise, it must be a two-argument procedure:
          ‘fold-services’ calls it, passing it the initial value of the
          service as the first argument and the result of applying
          ‘compose’ to the extension values as the second argument.  It
          must return a value that is a valid parameter value for the
          service instance.

What do you think?

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Incorrect service documentation?
  2018-03-23 10:09 Incorrect service documentation? Chris Marusich
@ 2018-03-26 12:57 ` Ludovic Courtès
  2018-03-29  5:38   ` Chris Marusich
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2018-03-26 12:57 UTC (permalink / raw)
  To: Chris Marusich; +Cc: guix-devel

Hello!

Chris Marusich <cmmarusich@gmail.com> skribis:

> Is the description of "compose" correct?  The manual claims that it
> "must return a value that is a valid parameter value for the service
> instance," but I do not think that is actually true.  Judging by the
> implementation of fold-services in (gnu services), it may return any
> single value as long as the extend procedure knows how to handle it.  In
> fact, it is the "extend" procedure which must return a valid parameter
> value for the service.

Yes, you’re right!  Good catch.

> If this is true, then I suggest we change the documentation as follows:
>
>      ‘compose’ (default: ‘#f’)
>           If this is ‘#f’, then the service type denotes services that
>           cannot be extended—i.e., services that do not receive “values”
>           from other services.
>
>           Otherwise, it must be a one-argument procedure.  The procedure
>           is called by ‘fold-services’ and is passed a list of values
>           collected from extensions.  It may return any single value.
>
>      ‘extend’ (default: ‘#f’)
>           If this is ‘#f’, services of this type cannot be extended.
>
>           Otherwise, it must be a two-argument procedure:
>           ‘fold-services’ calls it, passing it the initial value of the
>           service as the first argument and the result of applying
>           ‘compose’ to the extension values as the second argument.  It
>           must return a value that is a valid parameter value for the
>           service instance.
>
> What do you think?

LGTM!

Thank you,
Ludo’.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Incorrect service documentation?
  2018-03-26 12:57 ` Ludovic Courtès
@ 2018-03-29  5:38   ` Chris Marusich
  0 siblings, 0 replies; 3+ messages in thread
From: Chris Marusich @ 2018-03-29  5:38 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

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

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

> Hello!
>
> Chris Marusich <cmmarusich@gmail.com> skribis:
>
>> Is the description of "compose" correct?  The manual claims that it
>> "must return a value that is a valid parameter value for the service
>> instance," but I do not think that is actually true.  Judging by the
>> implementation of fold-services in (gnu services), it may return any
>> single value as long as the extend procedure knows how to handle it.  In
>> fact, it is the "extend" procedure which must return a valid parameter
>> value for the service.
>
> Yes, you’re right!  Good catch.

Thank you for confirming my understanding!

>> If this is true, then I suggest we change the documentation as follows:
>>
>>      ‘compose’ (default: ‘#f’)
>>           If this is ‘#f’, then the service type denotes services that
>>           cannot be extended—i.e., services that do not receive “values”
>>           from other services.
>>
>>           Otherwise, it must be a one-argument procedure.  The procedure
>>           is called by ‘fold-services’ and is passed a list of values
>>           collected from extensions.  It may return any single value.
>>
>>      ‘extend’ (default: ‘#f’)
>>           If this is ‘#f’, services of this type cannot be extended.
>>
>>           Otherwise, it must be a two-argument procedure:
>>           ‘fold-services’ calls it, passing it the initial value of the
>>           service as the first argument and the result of applying
>>           ‘compose’ to the extension values as the second argument.  It
>>           must return a value that is a valid parameter value for the
>>           service instance.
>>
>> What do you think?
>
> LGTM!

I've committed this as 881c61d06222a30dbffbf9d039eaca2abd3d22b3.

-- 
Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-29  5:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-23 10:09 Incorrect service documentation? Chris Marusich
2018-03-26 12:57 ` Ludovic Courtès
2018-03-29  5:38   ` Chris Marusich

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.