bug-guile
[Top][All Lists]
Advanced

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

bug#14164: letrec: detect illegal accesses to vars before entering body


From: Mark H Weaver
Subject: bug#14164: letrec: detect illegal accesses to vars before entering body
Date: Tue, 09 Apr 2013 01:14:58 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Nikita Karetnikov <address@hidden> writes:

> According to the manual [1], this snippet:
>
> (letrec ((a 42)
>          (b (+ a 10)))
>   (* a b))
>
> should return "Error: unbound variable: a."

The manual doesn't say anything nearly that specific.  It says "Note
that while the init expressions may refer to the new variables, they may
not access their values."  The R5RS says "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."

In general, if the manual says you "may not" do something, or if the
R5RS says "it is an error", that means that if you do, the results are
unspecified.  It does not constitute a promise to report an error if you
do.

I agree that we should ideally report errors such as this, but this is
not a bug, but rather a wishlist item.  Note that generating code that
detects programmer errors such as this may carry a non-trivial runtime
cost, so we might need to provide a distinct compilation mode that
inserts such debugging checks.

This is on my TODO list, but I wouldn't hold your breath :)

    Regards,
      Mark





reply via email to

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