unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Danny Milosavljevic <dannym@scratchpost.org>
To: Brendan Tildesley <mail@brendan.scot>
Cc: guix-devel@gnu.org, Leo Prikler <leo.prikler@student.tugraz.at>
Subject: Re: A better way to access records.
Date: Fri, 30 Oct 2020 20:47:32 +0100	[thread overview]
Message-ID: <20201030204732.18ac1eb4@scratchpost.org> (raw)
In-Reply-To: <cdcd38c0-164a-b0d3-5c46-6dafec8be62c@brendan.scot>

[-- Attachment #1: Type: text/plain, Size: 1091 bytes --]

Hi Brendan,

On Fri, 30 Oct 2020 21:59:59 +1100
Brendan Tildesley <mail@brendan.scot> wrote:

> No I didn't want to specify the fields at all, just have all of them 
> automatically defined.

I think that that is a bad idea for maintenance reasons.

This totally would hide variables from the enclosing context without you
being able to tell that it does so from the lexical context.

For example let's say you have:

(define-record <foo> size)

(let ((color 5))
  (with-record foo
    color))

And later on you update <foo> (but do not change the text of the with-record
usage at all), so in total you have:

(define-record <foo> size color)

(let ((color 5))
  (with-record foo
    color))

Now color is a different one!!

I don't even like unqualified imports for that reason: a change in a remote
place can affect what this module does without this module body referring
to it literally in the first place.

On the other hand, when directly specifying the fields

  (let ((color 5))
    (with-record (foo size)
      color))

I'm all for that.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-10-30 19:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-30 10:49 A better way to access records Leo Prikler
2020-10-30 10:59 ` Brendan Tildesley
2020-10-30 19:47   ` Danny Milosavljevic [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-10-30 10:28 Brendan Tildesley
2020-10-30 11:04 ` Bengt Richter
2020-10-30 18:17 ` Taylan Kammer
2020-10-31 22:01 ` Ludovic Courtès
2020-11-13 11:24   ` Brendan Tildesley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201030204732.18ac1eb4@scratchpost.org \
    --to=dannym@scratchpost.org \
    --cc=guix-devel@gnu.org \
    --cc=leo.prikler@student.tugraz.at \
    --cc=mail@brendan.scot \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).