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 ms0.migadu.com with LMTPS id YAM5Mbr+M2GUVgEAgWs5BA (envelope-from ) for ; Sun, 05 Sep 2021 01:18:18 +0200 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 mGvPLLr+M2GwBwAAB5/wlQ (envelope-from ) for ; Sat, 04 Sep 2021 23:18:18 +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 33F701A13A for ; Sun, 5 Sep 2021 01:18:18 +0200 (CEST) Received: from localhost ([::1]:55796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMevQ-000776-O9 for larch@yhetil.org; Sat, 04 Sep 2021 19:18:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMevC-00076w-N8 for bug-guix@gnu.org; Sat, 04 Sep 2021 19:18:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37296) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mMevC-0007Jg-Dt for bug-guix@gnu.org; Sat, 04 Sep 2021 19:18:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mMevC-0006x3-8z for bug-guix@gnu.org; Sat, 04 Sep 2021 19:18:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#50349: [PATCH] packages: Add 'define-package' syntax. Resent-From: Sarah Morgensen Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sat, 04 Sep 2021 23:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50349 X-GNU-PR-Package: guix X-GNU-PR-Keywords: patch To: Maxime Devos Received: via spool by 50349-submit@debbugs.gnu.org id=B50349.163079744526675 (code B ref 50349); Sat, 04 Sep 2021 23:18:02 +0000 Received: (at 50349) by debbugs.gnu.org; 4 Sep 2021 23:17:25 +0000 Received: from localhost ([127.0.0.1]:48842 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mMeua-0006wB-U1 for submit@debbugs.gnu.org; Sat, 04 Sep 2021 19:17:25 -0400 Received: from out1.migadu.com ([91.121.223.63]:41719) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mMeuX-0006vx-Jb for 50349@debbugs.gnu.org; Sat, 04 Sep 2021 19:17:23 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1630797439; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GvBJ3L7fuAG4UqrFomcQManyZCsFOPhLjrIv9uaIkDM=; b=JQOYUw2LCO6PT9Tfy41niIWgE6SFWf5K+i1gXkz8uclwrAtfRh8diRKAhMaoEjdgnBVktH cgVWuxvZN6E5ceJgAiqkYNEvFju+qQMLA/iQpq2Ye0L9uzIILaealQqHfr+PNdc0kpFM2m zWebZRgm0mGqwuv5pxlNkPGBP0ZJOJ4= From: Sarah Morgensen References: <15d01b32313f5f2f291b120597719ae92bd26acd.1630639896.git.iskarian@mgsn.dev> <757b7543b931335c3725264edfbc79c012aa10fc.camel@telenet.be> Date: Sat, 04 Sep 2021 16:17:16 -0700 In-Reply-To: <757b7543b931335c3725264edfbc79c012aa10fc.camel@telenet.be> (Maxime Devos's message of "Sat, 04 Sep 2021 10:42:02 +0200 (10 hours, 11 minutes, 11 seconds ago)") Message-ID: <86sfykj5hf.fsf@mgsn.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Auth-User: iskarian@mgsn.dev X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 50349@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1630797498; 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: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=GvBJ3L7fuAG4UqrFomcQManyZCsFOPhLjrIv9uaIkDM=; b=hCzTe8NqfVlrzJ8InvHCXpj1M3sx6kiTqh0/+/Pcgv+jXt/LjEhHKnNp02qXtnSS7DSLGR SuuA1fxh4JnNLqkE8veFqP2Gr/k6iGvaIaWHliTwIr1w4h7BY/WNVWKVJUQNduHCs+LVop Kvw38cj4/oUt/6mZ1ubRArcIgONCe3JlAEEdc2VroUSgJqdyvTkEK3t4k/PVx+IPq4vdnv oteaj+XRSUWxo2ViEPejkbkKyUljL1G69T0ChORMGw58E3NRrDDIgSG1gpCs2NkRI5zY6u N53L5ZqSev7lSTSGHznVC77d6RXtwKMaLkNO4RiPR//Ejq1Hc5tEM4CzCblq2A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1630797498; a=rsa-sha256; cv=none; b=uz0vQtvbz0kPx7mgLWgLhNgEf8D98M7Rpb3bH9OpAY8LGmLfL09rB1KYNbu0jELRocqIln xrxnGdexeGH4amkkhnb9e3gzRbhwx1Z/knvnmq/AMFPhN3CtXKCX4uiy9XFI+9E5yd1N9r 3rGkKBwWFyIAYf94xnZlrarKVKf+9dQYYOQ1JutvUfH52k/XwYHG+zH2J8/SFsblLFt4Lm OaFrOupvmkhNseZbTXSKhobwo2/gNHBCtnBPCCI0gaXrNVZB8BkoTiQVbRtSBBWxJS5njy sHJMLM8CsJe7fANfZpktlr+G/ogdXJruRfAQxLgJThLC2PtnMLfJQLHPRp+uqQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=JQOYUw2L; dmarc=fail reason="SPF not aligned (relaxed)" header.from=mgsn.dev (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Spam-Score: 0.18 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=JQOYUw2L; dmarc=fail reason="SPF not aligned (relaxed)" header.from=mgsn.dev (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Queue-Id: 33F701A13A X-Spam-Score: 0.18 X-Migadu-Scanner: scn1.migadu.com X-TUID: WcegiRcwvHzr Hi all, Thanks for your comments. I'm replying specifically to this message but these thoughts apply to the issue as a whole. Maxime Devos writes: > Sarah Morgensen schreef op do 02-09-2021 om 21:06 [-0700]: >> Hello Guix, >>=20 >> This patch adds a shorthand for "(define-public name (package ...))": >>=20 >> (define-package my-favorite-package >> (name "my-favorite-package") >> ...) > > This could be even shorter in the special case that the variable name > and package name are the same (modulo types): > > (define-package "my-favorite-package" > (version ...) > ...) > > 'datum->syntax' and 'string->symbol' can be used to turn "my-favorite-pac= kage" > into an identifier. > > A 'define-unexported-package' might be required in some places. Sure, or perhaps 'define-private-package'. I think this is pretty rare, though? And often in those cases other forms are used which may be incompatible with the macro, so they'll have to use the original syntax anyway. Either way is fine IMO. There are also about 150 packages which use 'package/inherit'. Should we introduce special syntax for them? What about 'hidden-package' (about 60 packages)? (And 11 use both!) About the only form I can think of that wouldn't break the composability of these kinds of things is something like (define-package* hello (hidden) (name "hello") ...) or (define-package* hello (hidden inherit-replacements) (name "hello") ...) Where 'hidden', 'inherit-replacements', and so on would be procs to apply (in the same order as compose?) that each transform the package. Or we could even have them transform the package syntax directly. But that's even more magic; it would take a fair amount of work, and be hard to get right. (How well would it hold up to syntax errors?) > > [...] > This looks nice to me. IIUC, the define-package is intended to be clearer > to newcomers, so you might want to ask for feedback on the new syntax on > help-guix@gnu.org. Thanks for the suggestion, I definitely will. With an eye toward newcomers, I think one "gotcha" of the "optional name" version is inheritance. If I have (define-package rust-actix-0.10 (name "rust-actix") ...) and then I write (define-package rust-actix-0.20 (inherit rust-actix-0.10) ...) At best, I would be unsure about whether this package would inherit the name. At worst, I would assume the name is inherited, and I would be wrong. If I have to write the name, there is no ambiguity. For the automatic naming (because of gotchas like that), and for possible extensions discussed above, I think right now I'm tempted to agree with Ludo's comment when this last came around (thanks to Tobias for pointing out the conversation)[0]: ludo@gnu.org (Ludovic Court=C3=A8s) writes: > However, I prefer treating packages just like any other Scheme object, > and to avoid introducing =E2=80=9Cmagic=E2=80=9D with macros like this. I could be convinced with an elegant enough implementation though! ;) [0] https://lists.gnu.org/archive/html/bug-guix/2013-09/msg00005.html -- Sarah