From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pierre Neidhardt Subject: Re: Parameterized packages Date: Tue, 21 Jan 2020 11:09:25 +0100 Message-ID: <87d0bdjf3e.fsf@ambrevar.xyz> References: <87o8v5ukgb.fsf@ambrevar.xyz> <87d0blhr9s.fsf@ambrevar.xyz> <20200116190644.uytvzvypuvdwh2iq@n0> <87d0bfrxr1.fsf@gnu.org> <87tv4qjy06.fsf@ambrevar.xyz> <875zh6rm5h.fsf@ambrevar.xyz> <20200120225722.oxg4pbggvir4o24i@n0> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:34075) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1itqTU-00082V-19 for guix-devel@gnu.org; Tue, 21 Jan 2020 05:09:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1itqTP-0004kc-Ve for guix-devel@gnu.org; Tue, 21 Jan 2020 05:09:31 -0500 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:37509) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1itqTP-0004ix-PY for guix-devel@gnu.org; Tue, 21 Jan 2020 05:09:27 -0500 In-Reply-To: <20200120225722.oxg4pbggvir4o24i@n0> 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-mx.org@gnu.org Sender: "Guix-devel" To: ison Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable ison writes: > Just a thought, but could this be achieved using Guile's parameterization > feature? > https://www.gnu.org/software/guile/manual/html_node/Parameters.html > > Not sure which method will be best overall, but its something to consider > and might avoid the need to define a bunch of extra functions. So basical= ly > all standard parameters could be defined globally using make-parameter, t= hen > in the parameters field of the package it lists the parameters they want > which will pick up the default values, or be overridden by parameterizati= on. > > Although I wonder if maybe it's better to not use global defaults for the > parameters and just let packages set their own defaults? Actually I don't know. An important feature of package parameters / USE flags is typing. But Guile does not have much support for typing as far as know. So if we need to implement some sort of typing in Guile, what we could do is create a Guile record with the following fields: =2D value =2D predicate The value should not be accessible directly, instead we need some function that will reference the value by first applying the predicate on it and throw an error if it returns #f. This way we can enforce some run-time typing. Not ideal but that could work. Any better option? Typed/Racket would be great here :) Otherwise, we can ditch the typing and use Guile parameters as you suggeste= d. =2D-=20 Pierre Neidhardt https://ambrevar.xyz/ --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEUPM+LlsMPZAEJKvom9z0l6S7zH8FAl4mzdUACgkQm9z0l6S7 zH9izAf9EmWoODyi58WtQLGzthby5NypJIdFfdrMXrwLr1NjgK5/y/NOOD6YiQG0 FN8ZJeP8TIvmgXeB2jCZLu1RcS+Q31R2BFbuUmLslaXC7GdiPaQ0EIltc4KcNVHw bQ2V0+VBZgcrAruo1TSptpkGbK37iKQuZf6Qih56jnHtBo3otNnptgVZ2Fo3ywgn dAjU0u4KLfXNSTbhcWHoTMu0jtzeolm6NGdD0IZ2nqgznchNlfEDIcThNd2bpqSm 1Prweh94NcxLw7N18wEuldkOLOc0esX7egaG+/zkc9PS2ZJZXQ6nndd+uRSeZjzj my6I43fENJeHRkiTJRGvqfTCvINhtg== =Dcy9 -----END PGP SIGNATURE----- --=-=-=--