From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Marusich Subject: Re: isc-bind service draft Date: Wed, 15 Nov 2017 19:21:49 -0800 Message-ID: <87tvxuewmq.fsf@gmail.com> References: <87vaijkyam.fsf@gmail.com> <87po8kno54.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39540) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFAkU-0003bC-My for guix-devel@gnu.org; Wed, 15 Nov 2017 22:21:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFAkT-000480-R5 for guix-devel@gnu.org; Wed, 15 Nov 2017 22:21:54 -0500 Received: from mail-pg0-x22a.google.com ([2607:f8b0:400e:c05::22a]:56894) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eFAkT-00046y-Kg for guix-devel@gnu.org; Wed, 15 Nov 2017 22:21:53 -0500 Received: by mail-pg0-x22a.google.com with SMTP id z184so14172460pgd.13 for ; Wed, 15 Nov 2017 19:21:53 -0800 (PST) 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: Oleg Pykhalov Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi Oleg, Chris Marusich writes: >> >> (define (emit-bind-options-config options) >> (match options >> (($ user _ run-directory pid-file >> listen-v4 listen-v6 listen-port >> allow-recursion? allow-transfer? >> allow-update? >> version hostname server-id) > > Some of these slots (e.g., listen-v4) appear to be un-used. Instead of > listing positional slots by name, maybe it would be better to bind the > entire to a variable, and then use the > accessor procedures (e.g., bind-options-configuration-listen-v4) to get > just the attributes you need. This has the benefit of being more > resilient to refactorings which change the order of fields in the > record, also. I realize that a lot of the code in Guix relies on > positional matching of slots like this, so I don't mind if you keep it > as-is, but consider my suggestion as food for thought. FYI, I just learned that there is a way to do this with pattern matching in Guile. You can write something like the following: (match options ((? bind-options-configuration? (=3D bind-options-configuration-listen-v4= listen-v4)) ;; Do something with listen-v4 (foo listen-v4))) As far as I know, this is the same as writing something like: (match options ((? bind-options-configuration? opts) (let ((listen-v4 (bind-options-configuration-listen-v4 opts))) ;; Do something with listen-v4 (foo listen-v4)))) =2D-=20 Chris --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEy/WXVcvn5+/vGD+x3UCaFdgiRp0FAloNBE0ACgkQ3UCaFdgi Rp3Jug/+IPU9US7WPNBk5kfMHokqRXa7FEU7McV2/3deJPBkfcjb75SdWDn9k354 r6tBSuslzU6kIhkhdoqI5ivoD2f4kTv09rE1XxxdBmqcae7iodu7o7oYx6KZSSEk E+U4Psn77BKpUbb7rV9/MQq8NGOnTqj4ZdzpqxcfPUWSOWz0S6YTAwEYtUYAxGxk 0i13F3LMRttwNqdKh3/9Nzffr3fKXm3UOTHXEn/oSUCvL3i5xdm3Pi31tYoaVXJM H6lf+KFcd25GZU1JOYHGMkbPQgq3iBWg4PTkoqPcQMtUD1auT590m+blnrCUZzkH VusHx+xC1OEi+5TVrt2nm48VkFrxPh6eIea9yxarKDf74dTdl+dZLd7swPe+SJhS 4Bynr2fBWU7d10D48swQHT4FtIMlkC3HUvwXsJYOKAgU368iUIDR4z0Uyu43Isa7 0rF5xLSfijEL3YnLvgfl/l8DPZ5UleuTqJmhB1u9i9eAxP0ZzVruNLJGQ12My0aP PKNkVOaX92bD4TpcPwF7AUG6K8BK+gG0B4ImQjLyhdqrym5FwsfTeT4Ip0aZ+ovK Z/kj7i8dGJgdLDlvLFt2pjLTSw2uILcSUv4f51wjw94Gt2abkcfmi7eFuj96XGqT uHLlljMUf2/DHIdA293b/0cRzINzft6RtWIaRcCwPWhvlJbcXyQ= =/Yif -----END PGP SIGNATURE----- --=-=-=--