guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A better way to access records.


From: Danny Milosavljevic
Subject: Re: A better way to access records.
Date: Fri, 30 Oct 2020 20:47:32 +0100

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: pgpIZWxsqpOes.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]