GNU bug report logs

#50349 [PATCH] packages: Add 'define-package' syntax.

PackageSource(s)Maintainer(s)
guix PTS Buildd Popcon
Full log

Message #29 received at submit@debbugs.gnu.org (full text, mbox, reply):

Received: (at submit) by debbugs.gnu.org; 4 Sep 2021 14:29:57 +0000
From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 04 10:29:57 2021
Received: from localhost ([127.0.0.1]:48344 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1mMWg8-0006S1-OJ
	for submit@debbugs.gnu.org; Sat, 04 Sep 2021 10:29:56 -0400
Received: from lists.gnu.org ([209.51.188.17]:47710)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <taylan.kammer@gmail.com>) id 1mMWg7-0006Rt-0a
 for submit@debbugs.gnu.org; Sat, 04 Sep 2021 10:29:55 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:34990)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <taylan.kammer@gmail.com>)
 id 1mMWg6-0003Wl-RB
 for guix-patches@gnu.org; Sat, 04 Sep 2021 10:29:54 -0400
Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:45978)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <taylan.kammer@gmail.com>)
 id 1mMWg4-0001yH-8H
 for guix-patches@gnu.org; Sat, 04 Sep 2021 10:29:54 -0400
Received: by mail-wm1-x32d.google.com with SMTP id
 j17-20020a05600c1c1100b002e754875260so1495485wms.4
 for <guix-patches@gnu.org>; Sat, 04 Sep 2021 07:29:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=bb6pH1j/rp/E3UEBUIYCqusd/6L5a0LqCZZvF7Iifr0=;
 b=kKe+0n6NJQDIoHDbDTx4l+DAFpt3gmTcmcjF/QSjZzZR+3gQWouua6l7iGkN5ewwX+
 xoXq4USA9gl+MBa/qoa6HzY3xSEVjC8wxLxA6GVtpCQcMnDwmzCTW0Mv5RkownsR+8aq
 EeAUyBVfzmLSNdEIZnxmCcDGi7G+oNXCiIE1RXRQPJ308MVe1vNLhi0amqxq4SVQ7VYT
 hn/l0PRoXtpLOSwc/tGnI3ePWGeEPKOCZnNy6ptKP9Q0T5Gk4ThhEurLP4+XM7ZI3SqK
 vzfIrmBYeuiuaAZoz7ymgStyQ4L2rd3BlNK20LcXENo2Dm14RD/vbpkqY1L6qZtvMbkR
 5FfQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:cc:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=bb6pH1j/rp/E3UEBUIYCqusd/6L5a0LqCZZvF7Iifr0=;
 b=tv501TGzdJS8jjGIL2dwQPGfa3OHGHYzcQGS1gQHHSoL4VQLunQXxL7B+Ua8/KiybT
 p3aAKoJZKdVqdM/2Wr3eBEBFGFWh503IES7uELpGkC8dSYKrlqRLjM0UShed4GqB3k68
 AIl6S9O4FD3V01s8OsOBmbHBDD8eq7zwzwkwpa3CDPaoJ40FVQGzpv+j7zcFWbPLHMpx
 5hg16c/5OqmW+JYd5wIfoYYmrNbjkOPb7wOxIogGWs2ypJEAyqOArWl6Nx7cdc1zoANU
 nHfIDdMoCl8qeAadoNR7LN1bDW+b+mKmnRqqxZvItElB0HL1TWvo3D6MldD+Y9a1AUXc
 zl0Q==
X-Gm-Message-State: AOAM531uR2AF411KOSGQouJfQNZOcodCTngnxsC+L7e8Un/6W7d+zd/C
 K0cswffjKq4/v65rsfCFHmYwkbb11dtXPQ==
X-Google-Smtp-Source: ABdhPJxVKuzVP9tPPdazt4w9o/XzIfKFmXKxucl1353lpp3xCYeshj5ndzAVR4AlAIrOXG7xiTMX7Q==
X-Received: by 2002:a1c:7e12:: with SMTP id z18mr3572409wmc.60.1630765790734; 
 Sat, 04 Sep 2021 07:29:50 -0700 (PDT)
Received: from [192.168.178.20] (b2b-109-90-125-150.unitymedia.biz.
 [109.90.125.150])
 by smtp.gmail.com with ESMTPSA id v21sm2406752wra.92.2021.09.04.07.29.50
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Sat, 04 Sep 2021 07:29:50 -0700 (PDT)
Subject: Re: bug#50349: [PATCH] packages: Add 'define-package' syntax.
To: Tobias Geerinckx-Rice <me@tobias.gr>, Maxime Devos <maximedevos@telenet.be>
References: <15d01b32313f5f2f291b120597719ae92bd26acd.1630639896.git.iskarian@mgsn.dev>
 <757b7543b931335c3725264edfbc79c012aa10fc.camel@telenet.be>
 <87y28caazy.fsf@nckx>
From: Taylan Kammer <taylan.kammer@gmail.com>
Message-ID: <95c92fc5-1fcf-b347-370e-d1943f22c2c3@gmail.com>
Date: Sat, 4 Sep 2021 16:29:49 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
 Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <87y28caazy.fsf@nckx>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=2a00:1450:4864:20::32d;
 envelope-from=taylan.kammer@gmail.com; helo=mail-wm1-x32d.google.com
X-Spam_score_int: -58
X-Spam_score: -5.9
X-Spam_bar: -----
X-Spam_report: (-5.9 / 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=-3.832, 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-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
Cc: Sarah Morgensen <iskarian@mgsn.dev>, 50349@debbugs.gnu.org,
 guix-patches@gnu.org
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request@debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit@debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request@debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request@debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
X-Spam-Score: -2.4 (--)
On 04.09.2021 12:09, Tobias Geerinckx-Rice via Bug reports for GNU Guix wrote:
> All,
> 
> To keep a link with previous ‘define-package’ discussion, I've merged this bug with #15284.  It was never resolved IMO and things have changed since 2013 with the label-less input style.
> 
> Maxime Devos 写道:
>> 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 ...)
>>   ...)
> 
> (define-anything STRING ...) is just too weird to ack.  Are there any package names that aren't currently valid symbols?  Is there a good reason for them?
> 
> Kind regards,
> 
> T G-R

To me the most obvious thing to do seems

  (define-package foo ...)  ;no explicit name needed

to bind the variable 'foo' and use symbol->string for the name of the
package, with the possibility to override the name like

  (define-package foo (name "foobar") ...)

which would bind the variable 'foo' to a package named "foobar".

Here's a syntax-case definition:

  (define-syntax define-package
    (lambda (stx)
      (syntax-case stx ()
        ((_ <name>
           (<field> <value> ...)
           ...)
         (if (memq 'name (map syntax->datum #'(<field> ...)))
             #'(define-public <name>
                 (package
                   (<field> <value> ...)
                   ...))
             #`(define-public <name>
                 (package
                   (name #,(symbol->string (syntax->datum #'<name>)))
                   (<field> <value> ...)
                   ...)))))))

-- 
Taylan




Send a report that this bug log contains spam.


debbugs.gnu.org maintainers <help-debbugs@gnu.org>. Last modified: Sun Dec 22 16:32:58 2024; Machine Name: wallace-server

GNU bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.