From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 2EGLKDB581+1BAAA0tVLHw (envelope-from ) for ; Mon, 04 Jan 2021 20:23:12 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id OBJVJDB5819VRwAAB5/wlQ (envelope-from ) for ; Mon, 04 Jan 2021 20:23:12 +0000 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 52A4E940276 for ; Mon, 4 Jan 2021 20:23:12 +0000 (UTC) Received: from localhost ([::1]:45966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kwWNj-0001R4-3C for larch@yhetil.org; Mon, 04 Jan 2021 15:23:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwWM4-0000Xv-6O for guix-devel@gnu.org; Mon, 04 Jan 2021 15:21:28 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:44940) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kwWM1-000578-8q for guix-devel@gnu.org; Mon, 04 Jan 2021 15:21:27 -0500 Received: by mail-wr1-x435.google.com with SMTP id w5so33375528wrm.11 for ; Mon, 04 Jan 2021 12:21:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=Py6ii64SkmiOfH66VotcTe56mEPa0qKsfIiFemx+cSs=; b=L/HeEseh2sIRSCp0SLB+cJV3yzECCucysuUhPJYLRhBnJZ7O/1Sdr0UTu4EEpLjHKz T6beKGppeVmc+g3Zz7iJ0XdkUXTto6QlLYDC5IboI/65wMR7jMVMaG7z4QthvS73ZZbZ X35yxvF5nND2BweJoqZKx/O9lI3lupn75umnFJJac2W6mD62v/oYaVIXIas1Jo6SLwRE sT72D+S5Qymk5p/7cc+71ausrhANF3K3KAFH0G/gZxmV8fCBLvmQVkTdPzYFVKpy1Kc8 lII+U+N9qfTS0+lPLOISz30L5z4LHjtIMfWk8ePDZ834bVwxGKFCrDomCH3VjNc6nts5 h7wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Py6ii64SkmiOfH66VotcTe56mEPa0qKsfIiFemx+cSs=; b=ewGZXpP3zaN8nNKCgLfXA7ysd2vU2wRDHT9/HxZj6NHWl0F/28P+E29QTEvK2ie9D9 Keac9KlD0lRCLHskfzrfzss2s5b3AM216aSiyN+DdCdWNvQEwD+Ma0zT1twLAVKK7oBQ lA4gYzHUtHHFDqeuvbvIS1VqPgKIH5mg9LZP/p+jeQ44RUfucv3E9J/5QGO7tPH+hpaO es5GYWgvupUc8vU/bJUYP9ib+XqperHlpJgwz7py1y8P0u2ksggGKXvL3530sRhWaG3p ps3WYb/Q6BRbNxjXwBfPOKPGlV2+lMIZvZJecebJ3VLYd37usZx/oxLIY7Sh+rKYhU23 piuw== X-Gm-Message-State: AOAM531SazSpEXj3AMufonc70kiBSrm3p1roFOQh33lrwEILlrVzU7XO cu0WcHewjtzg/pr+h/UoPtstYgoksHo9Ow== X-Google-Smtp-Source: ABdhPJzp7OIPt0kkX2BTJh5ZXuFw40VfU3Mah29pPg3o7g+qrms44LHYtdk14Xdp0mQjKH+f/nV1HQ== X-Received: by 2002:adf:e710:: with SMTP id c16mr82827847wrm.295.1609791682698; Mon, 04 Jan 2021 12:21:22 -0800 (PST) Received: from [192.168.178.20] ([109.90.125.150]) by smtp.gmail.com with ESMTPSA id g5sm90596954wro.60.2021.01.04.12.21.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Jan 2021 12:21:22 -0800 (PST) Subject: Re: A new paradigm for modifying operating system declarations To: raid5atemyhomework , "guix-devel@gnu.org" References: From: Taylan Kammer Message-ID: <87b59430-b53e-47ec-32d5-abbd3be42ce7@gmail.com> Date: Mon, 4 Jan 2021 21:21:20 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=taylan.kammer@gmail.com; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list 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+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -3.03 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=L/HeEseh; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: 52A4E940276 X-Spam-Score: -3.03 X-Migadu-Scanner: scn1.migadu.com X-TUID: gQj0UIQix+v+ On 04.01.2021 16:38, raid5atemyhomework wrote: > Hi guix-developers, > > I'd like to propose an idea for constructing `` objects. > > [... snip ...] > > What are your opinions? Blech? Yummy? Is it worth exploring this paradigm for adding particularly complex features to an operating system definition? Hi, Interesting idea. First, let me point out a more conventional alternative to what your 'decorate' macro does: (define (compose proc . rest) "Functional composition; e.g. ((compose x y) a) = (x (y a))." (if (null? rest) proc (let ((rest-proc (apply compose rest))) (lambda x (let-values ((x (apply rest-proc x))) (apply proc x)))))) This allows for something like: ((compose install-foo install-bar install-zfs) (operating-system ...)) Or perhaps cleaner: (define my-os-modifier (compose install-foo install-bar install-zfs)) (my-os-modifier (operating-system ...)) If you need custom modifications within, you can do: (define my-os-modifier (compose install-foo (lambda (os) ...) install-bar)) It's more verbose, but doesn't "break" standard Scheme syntax as much. Function composition is conceptually pretty easy and probably more well-known than "decorators" (which I had never heard of, personally). Fewer macros means the reader needs to keep fewer special rules in mind. --- Secondly, I wonder if passing an OS declaration through various procedures that modify it is really the best approach in the first place. For build phases, we have the 'modify-phases' syntax. For services, there is 'modify-services'. Maybe there should be a 'modify-os' kind of syntax. (In other words, if we're going to invent new syntax, why not go all-out and create the most convenient syntax for the use-case.) Just my thoughts. - Taylan