GNU bug report logs

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

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

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

Received: (at 50349) by debbugs.gnu.org; 4 Sep 2021 23:17:25 +0000
From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 04 19:17:25 2021
Received: from localhost ([127.0.0.1]:48842 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	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 <iskarian@mgsn.dev>) 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 <iskarian@mgsn.dev>
To: Maxime Devos <maximedevos@telenet.be>
Subject: Re: [bug#50349] [PATCH] packages: Add 'define-package' syntax.
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-Flow: FLOW_OUT
X-Migadu-Auth-User: iskarian@mgsn.dev
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 50349
Cc: Taylan Kammer <taylan.kammer@gmail.com>,
 Tobias Geerinckx-Rice <me@tobias.gr>, 50349@debbugs.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: -1.7 (-)
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 <maximedevos@telenet.be> writes:

> Sarah Morgensen schreef op do 02-09-2021 om 21:06 [-0700]:
>> Hello Guix,
>> 
>> This patch adds a shorthand for "(define-public name (package ...))":
>> 
>> (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-package"
> 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ès) writes:

> However, I prefer treating packages just like any other Scheme object,
> and to avoid introducing “magic” 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




Send a report that this bug log contains spam.


debbugs.gnu.org maintainers <help-debbugs@gnu.org>. Last modified: Sun Dec 22 16:05:44 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.