From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: RFH: Add prosody service Date: Sun, 04 Dec 2016 22:11:21 +0100 Message-ID: <87lgvv5rie.fsf@gnu.org> References: <874m2uxiuu.fsf@lassieur.org> <87polfl3np.fsf@gnu.org> <87y3zybmsv.fsf@lassieur.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35202) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cDe4F-0004EN-Pp for guix-devel@gnu.org; Sun, 04 Dec 2016 16:11:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cDe4B-0004AF-QN for guix-devel@gnu.org; Sun, 04 Dec 2016 16:11:27 -0500 In-Reply-To: <87y3zybmsv.fsf@lassieur.org> (=?utf-8?Q?=22Cl=C3=A9ment?= Lassieur"'s message of "Fri, 02 Dec 2016 12:19:44 +0100") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: =?utf-8?Q?Cl=C3=A9ment?= Lassieur Cc: guix-devel Hello Cl=C3=A9ment, Cl=C3=A9ment Lassieur skribis: >>> B. Common settings should have a default value in prosody-configuration, >>> and be disabled by default in the list of virtualhost-configurations. >> >> Oh, I see. >> >>> I found two ways to solve this: >>> >>> 1. One uses "eval" to transform the input of "define-configuration" into >>> a list that I can build from other lists. >>> >>> 2. The other uses a macro that takes define-configuration's input, plus >>> a tag (called target) describing whether it's a global, common, or >>> virtualhost specific field. Then the macro calls >>> define-configuration many times, each time with a subset of the >>> original input, filtered with a specific tag ("global", >>> "virtualhost") plus the "common" tag. >>> (Its name is define-all-configurations.) >> >> I think you could always write a =E2=80=98define-common-configurations= =E2=80=99 macro on >> top of =E2=80=98define-configuration=E2=80=99 that would let you specify= two default >> values: one for the global context, and one for the virtual-host >> contexts. (Thus, no need for =E2=80=98eval=E2=80=99: the code is genera= ted at macro >> expansion time.) >> >> Would that work? > > That's kind of what I did here: > http://lists.gnu.org/archive/html/guix-devel/2016-11/msg01075.html > > The macro 'define-all-configurations' defines two default values: one > for the global context (def) and one for the virtual-host context > ('disabled). > > (The macro I did also changes the doc and the type, depending on whether > it's a virtualhost or not.) Sounds good. >> It would allow you to avoid repeating field definitions, but you=E2=80= =99d end >> up with two almost identical record types that are completely disjoint >> (no inheritance in particular.) This may or may not be desirable. >> >> For record type inheritance, we=E2=80=99d need SRFI-99 or something equi= valent. > > Which is not implemented by Guile, is it? No, though maybe the reference implementation just works. Alternate, SRFI-35 and (rnrs records), both available in Guile, support inheritance. > So is what I did desirable? Or maybe should we wait until we have > something similar to SRFI-99, and use opaque-prosody-configuration only? What you did looks good. Whether proper inheritance should be prefer over the purely syntactic approach you took is something I can=E2=80=99t an= swer; I guess it depends on the semantics and expected use of those data structures. So if it sounds good to you, we can certainly start with the patch you have (minus duplication with (gnu services configuration).) WDYT? >> So you could define a =E2=80=98maybe-string=E2=80=99 type, say, with an = associated >> serializer. >> >> How does that sound? > > That's also what I did here: > http://lists.gnu.org/archive/html/guix-devel/2016-11/msg01075.html Perfect. :-) Sorry for the delay, I admit I got lost in the discussion, my bad! Thanks, Ludo=E2=80=99.