unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: iyzsong@member.fsf.org (宋文武)
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: Change defaults of 'define-record-type*' need invalidate auto-compilation caches
Date: Mon, 08 Jan 2018 20:49:58 +0800	[thread overview]
Message-ID: <87vagcikg9.fsf@member.fsf.org> (raw)
In-Reply-To: <87po6khc0o.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Mon, 08 Jan 2018 11:37:27 +0100")

ludo@gnu.org (Ludovic Courtès) writes:

> Hi!
>
> iyzsong@member.fsf.org (宋文武) skribis:
>
>> [...]
>>
>> Only with '--fresh-auto-compile' or delete the cache of x.scm, I will
>> get the output "y".
>>
>> Is this a bug?
>
> It’s a feature.  :-)
>
> Namely, default value resolution happens at macro-expansion time:
>
> scheme@(guile-user)> ,use(guix records)
> scheme@(guile-user)> (define-record-type* <foo>
>   foo make-foo foo?
>   (x foo-x (default "x")))
>
> scheme@(guile-user)> ,expand (foo)
> $2 = (let* ((x "x")
>        (s ((@@ (srfi srfi-9) allocate-struct) <foo> 1)))
>   ((@@ (srfi srfi-9) struct-set!) s 0 x)
>   s)
>
> That way, we can check at macro-expansion time that all the required
> fields are present, which is nice.
>
> The downside is what you write: that everything that uses the record
> type must be recompiled when it is changed (IOW, the record type is part
> of the ABI).
>
> HTH!

Get it, thanks for the explanation!

      reply	other threads:[~2018-01-08 12:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-06 14:55 Change defaults of 'define-record-type*' need invalidate auto-compilation caches 宋文武
2018-01-06 15:07 ` 宋文武
2018-01-08 10:37   ` Ludovic Courtès
2018-01-08 12:49     ` 宋文武 [this message]

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=87vagcikg9.fsf@member.fsf.org \
    --to=iyzsong@member.fsf.org \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /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).