unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: guix-devel@gnu.org
Subject: Re: Layout of ‘define-configuration’ records
Date: Wed, 23 Nov 2022 22:56:51 +0100	[thread overview]
Message-ID: <874jupfi70.fsf@gnu.org> (raw)
In-Reply-To: <87edtwqa87.fsf@gmail.com> (Maxim Cournoyer's message of "Mon, 21 Nov 2022 16:16:40 -0500")

Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:

[...]

>>>> One last thing: placing ‘%location’ first can let us implement:
>>>>
>>>>   (define (configuration-location config)
>>>>     (struct-ref config 0))
>>>
>>> Would this have worked?
>>>
>>> scheme@(gnu services mcron)> (define config (mcron-configuration))
>>> scheme@(gnu services mcron)> (struct-ref 0 config)
>>
>> You got the order wrong.  :-)
>
> Ah!  Thanks for pointing my silly mistake.  Then the argument would
> become... if it's good for define-configuration, it should have been
> good for define-record-type* the same (why the discrepancy?).

‘define-record-type*’ is generic; there’s no reason for it to add a
‘location’ field.

> After your new documentation in place to guide users to DTRT with
> regards to matching records, if you think %location should be the first
> field, then we should make it so in both instances, perhaps?

‘%location’ only appears in ‘define-configuration’; what did you mean by
“both instances”?

> Oops!  Another point to add to our future coding style guidelines :-).

In the end, I guess the lesson is that, indeed, not all the design
choices and rationales are properly documented.  That’ll always be the
case to a large extent though, so changes “close to the core” require
more careful review and discussion to fully understand the implications
of the change—it might look innocuous but have broader implications than
expected.

Thanks,
Ludo’.


  reply	other threads:[~2022-11-23 21:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221029034716.11125-1-maxim.cournoyer@gmail.com>
     [not found] ` <20221029041649.12144-1-maxim.cournoyer@gmail.com>
2022-11-17 22:37   ` Layout of ‘define-configuration’ records Ludovic Courtès
2022-11-18 16:44     ` Maxim Cournoyer
2022-11-19 21:25       ` Katherine Cox-Buday
2022-11-20 13:47         ` Maxim Cournoyer
2022-11-21 10:26           ` Ludovic Courtès
2022-11-21 20:08             ` Maxim Cournoyer
2022-11-21 16:49           ` Katherine Cox-Buday
2022-11-21 21:00             ` Maxim Cournoyer
2022-11-22 14:52               ` zimoun
2022-11-25 15:18                 ` Maxim Cournoyer
2022-11-21 10:22       ` Ludovic Courtès
2022-11-21 21:16         ` Maxim Cournoyer
2022-11-23 21:56           ` Ludovic Courtès [this message]
2022-11-25 15:15             ` Maxim Cournoyer

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=874jupfi70.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    /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).