From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id ILz9NFsRCWLfhgAAgWs5BA (envelope-from ) for ; Sun, 13 Feb 2022 15:10:35 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id uE7GLVsRCWK3vgAAG6o9tA (envelope-from ) for ; Sun, 13 Feb 2022 15:10:35 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4C264D990 for ; Sun, 13 Feb 2022 15:10:35 +0100 (CET) Received: from localhost ([::1]:40312 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nJFaB-0005jb-QI for larch@yhetil.org; Sun, 13 Feb 2022 09:10:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49530) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJFZT-0005g8-Ls for guix-devel@gnu.org; Sun, 13 Feb 2022 09:09:47 -0500 Received: from [2a00:1450:4864:20::144] (port=43559 helo=mail-lf1-x144.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nJFZQ-0000vA-PW for guix-devel@gnu.org; Sun, 13 Feb 2022 09:09:47 -0500 Received: by mail-lf1-x144.google.com with SMTP id g39so2467345lfv.10 for ; Sun, 13 Feb 2022 06:09:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop-in.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=HXAmUbkWwbruZqgy43DFz2MQ6iFpvEGKw5Qh02PCmV8=; b=JCQwMZMLVdE1cVW1nAAnPMqFbyXJoImYfFCiD/9lzjJv9Uo8RGckpoYU4u0R64sNWz IcVll5yF9aAtCLKPjNYgFxkl0kcZA0uzbO5l6uyA3UNQBKI2jxQEttkNmP9YetmvlQqS rqGf+9FYg5/mRxzmvflHCuqSljSyk1ynmPvJeevhGn9V1WxxZLCzMx0F/ZDoy4c/s3J8 NlIbxbbCfJq/FsnMHDCq9ADS3Wcnkcci1XaMVq4O01yqO0UZELAEJyoAk0HZDQb/ab20 CirMnZ1AfsX8m/MMqkmBTLkpeBOHBZNLtRuxs0dvSFVM345TwcTZLWY9UqyylTN327bx JiXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=HXAmUbkWwbruZqgy43DFz2MQ6iFpvEGKw5Qh02PCmV8=; b=yAidm0F0IP2gxVfAZ+f5BSfE+TheHPSmD6PEAcCh/c2VrfiuCFgIcH2JoQXwqo/PEV IwRHW6hnelBaecXHXkMDIxhzv1gnuwU0ePBNbWs1xZO6aqPuFmeu9+1YtnuU1kLFK+cu gPCppjFRMXeMIpidrBaFrE1zvD/M61JBMK4zvTKm9IDPWprTHZbmo6OYqzmJu/Y/9xKr J4AitDnj4Zec1uDLhEmN/NXj8qjTQZX1CYc3ghn3TW5e9cM3TPZ8ksGNGq9mi+yU676h 2Ow5LNhJtWaIqUF3ryeHQ+SCkQUUq521Rur9CWEvJI+SQpx3wSmstrbIQNjeadMqyq7p Suzw== X-Gm-Message-State: AOAM5329RFCqMYRuRuq17o18n/WeI3vQbvqOYcTp3MFbB3RcAO2hyKl0 0rxXzRivmA/gxcLpdnKMLgKGWQ== X-Google-Smtp-Source: ABdhPJwyZduwDLhUuKTsGgXvkfhsT0UJw5szZTlCFYF6acikv/W/O4DWPbsBacyaIt4oHpzlrAEang== X-Received: by 2002:a05:6512:e9d:: with SMTP id bi29mr7438569lfb.652.1644761382634; Sun, 13 Feb 2022 06:09:42 -0800 (PST) Received: from localhost ([91.228.246.230]) by smtp.gmail.com with ESMTPSA id e14sm570028lfs.146.2022.02.13.06.09.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Feb 2022 06:09:41 -0800 (PST) From: Andrew Tropin To: Maxime Devos , Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: Return back original implementation for text-config serialization In-Reply-To: <95f26136ec9babaf6b6544ca169495eb70953249.camel@telenet.be> References: <878rvp1deg.fsf@trop.in> <87mtjtglxd.fsf@gnu.org> <87o846y24v.fsf@trop.in> <405630188ac22fd2a1f1d0e0555ce061584744a3.camel@telenet.be> <87fspax5ac.fsf@trop.in> <95f26136ec9babaf6b6544ca169495eb70953249.camel@telenet.be> Date: Sun, 13 Feb 2022 17:09:37 +0300 Message-ID: <87k0dyoo2m.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::144 (failed) Received-SPF: none client-ip=2a00:1450:4864:20::144; envelope-from=andrew@trop.in; helo=mail-lf1-x144.google.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, PDS_HP_HELO_NORDNS=0.785, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, WEIRD_QUOTING=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org, Xinglu Chen , guix-maintainers@gnu.org Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1644761435; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=HXAmUbkWwbruZqgy43DFz2MQ6iFpvEGKw5Qh02PCmV8=; b=nWeEeyKgwg5Fhqx5PbNHIvGb1p3e1U6mE4vAlReJUAPpp7laEBweSEw/xFNAjiwXF4o255 whQusYyytrARstcyVoT8/HXOQ0mNmT4oAV6RJsQyF68qtZQzBnaUsljk1ZpV6rz7iTE9OV dmmx2ElOaCZ69eizD1Rzi8d1cXxcabT2VMsUjTnP9nxJ3c4sMuHzBJxUxsold5vcOfadW6 y0H6BsLyko4QmLHM73iMjybF5FCuQi7ITsKke52NPXdskQtEviYL2uSky1Zduy0hfbaxfU 30LUwcJE66AD9TnedajAgl+3nAamuMCSRkUKd7IIgoQjUcLz+uGUGwly69hcFQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1644761435; a=rsa-sha256; cv=none; b=f+3Syw5SFmVWSu3DKuDZT/N1gJM8DDZwr6sU/0BIyq/Sr7Zsdd6g8akGgqUXhwbqDo+IHR e5K2qgPYcjqUJ3ZBqqmG2ibsCcI3DWGpf5/taa6T+CS/pixQa8fgRLI3x8CIQJy3r+W2eC 67JEuIJY8iklc4ExPoFGW28ymLcSwzZs229RnPHjm2gkkfkTmuc6qsyzG9aepM/WSluW6x 9xlf096NORg1vBUgToE08aC6et5nWFOvKiqm/0Icpw1ngM7raa8hXod7FxS3N7XGqgO89R jIJdRAoxI3ZlsUGGdLRlAjJWRcJMxcADU0ZB8IXAZpYlYitC5QTNrchymltqnA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=trop-in.20210112.gappssmtp.com header.s=20210112 header.b=JCQwMZML; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.43 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=trop-in.20210112.gappssmtp.com header.s=20210112 header.b=JCQwMZML; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 4C264D990 X-Spam-Score: -5.43 X-Migadu-Scanner: scn1.migadu.com X-TUID: 8FDTViji7JOp --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On 2022-02-05 12:34, Maxime Devos wrote: > Andrew Tropin schreef op wo 26-01-2022 om 11:36 [+0300]: >> In addition to the problems I mentioned above: >>=20 >> 1. Mixed usage of two configuration languages (nginx-conf and lisp). >> 2. Having a string, which should be properly escaped (luckily for >> this >> example it's not a problem). > > Mixing two configuration languages can be avoided by supporting > everything with records. > I suppose it will lead to a huge maintenance burden, but it's just a guess. >>=20 >> we also: >>=20 >> 3. Have to implement our own templating engine (using format function >> in this case) to share the values from guile with the config. > > This seems to be the same for this list based configuration system > and record based configuraiton system; for the nginx example you gave, > all these lists with parentheses need to turned into something with > brackets that nginx understands anyway. > >> 4.1. Don't know where extra-content goes. (It goes to http section >> not the >> end of the file, so we have to start with "}" to get a correct >> configuration). > > Can be solved by adding missing options to the Guix service definition > (and documentation) when the need arises. > >> 4.2. Don't control where it must be placed. (Can be important in >> other >> use cases, which I can share if needed). > > Likewise. > >> 5. Have inconsistent implementation of extra-config, extra-content, >> raw-lines >> and other escape hatches (We need to learn it everytime we write a >> new >> service configuration). > > Likewise. > > Also, the mapping of upstream configuration files to lists in Guix > seems far from obvious to me: in https://issues.guix.gnu.org/52698, > how am I supposed to know that 'us,ru' must be a symbol, why isn't > it a string? It's quite obvious. ((layout us,ru)) will be translated to `layout us,ru` and this is what expected by man 5 sway-input. Strings and their purpose are covered below. > If one of the strings for some property includes a special character > from the configuration language (say, '$'), should it be escaped in > Guix ((bindsym ... "[class=3D\"$100 dollars\"]" ...) or (bindsym > ... "[class=3D\"\\$100 dollars\""]""))? Not sure about this question. If this character have to be escaped in the target configuration, "[class=3D\"\\$100 dollars\"]" will produce what you need: [class=3D"\$100 dollars"]. According to string serialization: In first iteration I made a soft escape hatch (all strings are serialized to its values), it made it possible to express this CRITERIA (man 5 sway) statement you menshioned above. I added a proper gexp support a little later, but the example with string already was in use. Currently it should be done this way: `((bindsym ... ,#~"[class=3D\"$100 dollars\"]" ...)) And probably strings must be serialized to quoted values now, if I make home-sway v2 it will be done this way. I didn't make a CRITERIA to be a part of a grammar because: 1. I needed a working prototype fast to move forward on Guix Home itself. 2. I encountered a bug in guile compiler and already spend a lot of time on home-sway service, after I finally localized it and it was fixed by Andy. I decided to postpone further improvements of sway service for later times. > Why (bindsym ... "[class=3D\"foo\"]") instead of > (bindsym ... (=3D class "foo"))? This one is good. As you see I didn't made a CRITERIA a part of the grammar, so there is no proper way to express it without escape hatch, however home-sway v2 can be done slightly different, more on that in the reply to lists and vectors question. > > Why (bindsym ... exec emacsclient ...) and not > (bindsym ... exec (file-append emacs "/bin/emacsclient) ...)? > How am I supposed to know whether emacs is in the path or not, > and if it is, is this merely an implementation detail? In most cases it should be `((bindsym ... exec ,(file-append emacs "/bin/emacsclient") ...)) You are right. > > How would I know if it's (bindsym ... exec emacsclient -c --eval > "'(eshell)'") or (bindsym ... "exec emacsclient -c --eval > \"'(eshell)'\"")? Since the idea is to keep as close to the > configuration language as possible, shouldn't it be the second? exec is a part of configuration grammar and it should not be quoted. Command itself doesn't have to be quoted too, but probably can be if you want: `((bindsym ... exec ,#~"'emacsclient -c --eval \"\\'(eshell)\\'\"'")) > > Why lists and not vectors? This one is good as well, back in the day I was implmenting home-sway service I didn't have much experience with guile vectors. I tried not to be any fancy and used lists for both sequential and associative data structures. Vectors can be a good match, also it will be easier to make a CRITERIA to be a part of a grammar and be used without escape hatch. In the combination of proper string serialization it will look like: =2D-8<---------------cut here---------------start------------->8--- `#(#(bindsym $mod+o ((class . "foo") (tiling) (window_type . toolbar)) kill) #(bindsym $mod+e exec ,(file-append emacs "/bin/emacsclient")) ,#~"# This is comment\n# Layout related settings:" #(input #(#(xkb_layout us,ru) #(xkb_variant dvp,)))) =2D-8<---------------cut here---------------end--------------->8--- and the resulting config will be: =2D-8<---------------cut here---------------start------------->8--- bindsym $mod+o [class=3D"foo" tiling window_type=3Dtoolbar] kill bindsym $mod+e exec /gnu/store/2808l07ld4hzlmlslvbqjlqrprw7f1xz-emacs/bin/e= macsclient # This is comment # Layout related settings: input * { xkb_layout us,ru xkb_variant dvp, } =2D-8<---------------cut here---------------end--------------->8--- Sharps are a little bit noisy, but such config is a little more complete than original one, probably easier to parse, type check and serialize. Also, I used vectors recently for serialization to a few different type of configuration formats and quite satisfied with them. Thank you very much for a fresh look, the thoughtful questions and ideas! Only the knowledge I got thanks to this discussion is worth starting this thread :) =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJDBAEBCgAtFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmIJESEPHGFuZHJld0B0 cm9wLmluAAoJECII0glYwd6wTY4P/3sd4+1Se+8NmD9azHph7y39o5DEv43LnwpH nRIP1M0WPb8SfwWYoUMgVW0hNQzEgbyrg6hNf9IFbvHSw9WKXd0JACbv6ybd4LxQ GyLsZ9zpIHXXgauYQZBERVyrZuupgn9fwIk6UpbzkpScYH82SPWyqhslX24JEsUk 08UPZ74dAYLSHIEvgTBnMFAQxsJozYVh0hyV7v2jAA9AWQx3PrEB8TizzlnZSSEN Al5JjbU7NU13C86b8gny7g7eYqUD/reCbhuGZlGDVhhdNwF+cuOCXTsDuPFeWcS6 HSODWwDKJd4O6fnokMNW+WP83f+uoTsBIaycSsU24grCFzSAhkN2feiTHH519AJJ Vf36yA9zFTe55pV8inDLqEnQUhLvvjtxvm6Q3O50qtS5/qMdLvHiwFnr82VJ8DUz izSt7K0umqIOWZr+H0ZcDjaGHatujvLacftoGtBOAPXz2k4tZdQsZVfeW6g1nW15 M3aOQQ587T2wAX4gF8wHF2SHuQLrLjAseI8Rqhm6xtBB/4fmS+Snm6HoYlnnaXs6 iR4Mf/bCcAQyl2XYQI4+Z143vZGTGpcSgbwpqz6RlfT5sjD1gjv6umA6hA6Ds8ZY XVtf++S2gL7tp2UHI7xl9zXqHgDFCi5FkaE5+LTpZfF1UO9duro5uM9nDbU1x0tL nsrAI0Pp =bW0l -----END PGP SIGNATURE----- --=-=-=--