unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Rob Browning <rlb@defaultvalue.org>
To: Mark H Weaver <mhw@netris.org>
Cc: guile-devel@gnu.org
Subject: Re: Should letrec via syntax work within eval-when (expand load eval)?
Date: Mon, 05 Aug 2019 20:33:37 -0500	[thread overview]
Message-ID: <87r25zt6vi.fsf@trouble.defaultvalue.org> (raw)
In-Reply-To: <87zhkn8ppe.fsf@netris.org>

Mark H Weaver <mhw@netris.org> writes:

> The 'letrec' form above is indeed invalid.  As the R5RS states:
>
>      One restriction on 'letrec' is very important: it must be possible
>      to evaluate each <init> without assigning or referring to the value
>      of any <variable>.  If this restriction is violated, then it is an
>      error.  The restriction is necessary because Scheme passes
>      arguments by value rather than by name.  In the most common uses of
>      'letrec', all the <init>s are lambda expressions and the
>      restriction is satisfied automatically.

Yeah, I'd read that originally, but not paid quite close enough
attention (obviously).  Switching to a wrapper lambda worked just fine.

> This particular example happens to work when compiled by recent versions
> of Guile, but that's suboptimal.  Ideally, we should report an error in
> this case.

Indeed, not strictly necessary, but would have been nice, so I'd have
realized more quicly that I was doing it wrong.

Thanks again for the help.
-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4



      reply	other threads:[~2019-08-06  1:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-30  1:57 Should letrec via syntax work within eval-when (expand load eval)? Rob Browning
2019-08-01 23:13 ` Rob Browning
2019-08-05 17:52   ` Mark H Weaver
2019-08-06  1:33     ` Rob Browning [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://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=87r25zt6vi.fsf@trouble.defaultvalue.org \
    --to=rlb@defaultvalue.org \
    --cc=guile-devel@gnu.org \
    --cc=mhw@netris.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.
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).