GNU bug report logs - #34999
Record special field abstraction leakage

Previous Next

Package: guix;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Tue, 26 Mar 2019 09:39:01 UTC

Severity: important

To reply to this bug, email your comments to 34999 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#34999; Package guix. (Tue, 26 Mar 2019 09:39:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ludovic Courtès <ludo <at> gnu.org>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Tue, 26 Mar 2019 09:39:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: bug-Guix <at> gnu.org
Subject: Record special field abstraction leakage
Date: Tue, 26 Mar 2019 10:38:11 +0100
The changes I made in version-control.scm and gnucash.scm in commit
e6301fb76d0a8d931ece2e18d197e3c2cc53fc6c revealed an abstraction leakage
I wasn’t aware of: there’s a pattern where users “see” that thunked
fields are thunked:

  (package
    ;; …
    (inputs …)
    (arguments `(foo bar ,(inputs) …)))  ;<- here ‘inputs’ is seen as a thunk

Fortunately I could only find two occurrences of this and this use case
is more elegantly replaced by:

  (package-inputs this-record)

… which also has better semantics.  It’s remains a bug, though.

Ludo’.




Severity set to 'important' from 'normal' Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 04 Apr 2019 11:27:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-guix <at> gnu.org:
bug#34999; Package guix. (Tue, 24 Aug 2021 15:48:02 GMT) Full text and rfc822 format available.

Message #10 received at 34999 <at> debbugs.gnu.org (full text, mbox):

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: Ludovic Courtès <ludo <at> gnu.org>, 34999 <at> debbugs.gnu.org
Subject: Re: Record special field abstraction leakage
Date: Tue, 24 Aug 2021 17:47:30 +0200
[Message part 1 (text/plain, inline)]
Hi Ludo,

I think I have found out why users see the thunked fields as below.
Am Dienstag, den 26.03.2019, 10:38 +0100 schrieb Ludovic Courtès:
> The changes I made in version-control.scm and gnucash.scm in commit
> e6301fb76d0a8d931ece2e18d197e3c2cc53fc6c revealed an abstraction
> leakage
> I wasn’t aware of: there’s a pattern where users “see” that thunked
> fields are thunked:
> 
>   (package
>     ;; …
>     (inputs …)
>     (arguments `(foo bar ,(inputs) …)))  ;<- here ‘inputs’ is seen as
> a thunk
The issue is that for constructing the records, we let*-bind the field
names to their values before calling the constructor.  In these let*-
bindings the fields are already wrapped, e.g. inputs will be bound to
the value that the record field inputs will have, not to the raw value.

I've attached a patch to fix this issue as well as a MWE to try it out.
I'm not sure about the broader semantics of this patch, though.  I fear
that exposing raw values through let-binding probably eliminates the
delayed/thunked nature of said fields in some ways.  WDYT?
[0001-guix-records-let-bind-raw-values-wrap-them-in-constr.patch (text/x-patch, attachment)]
[34999-mwe.scm (text/x-scheme, attachment)]

This bug report was last modified 2 years and 239 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.