[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-janitors] #1297: variables defined inside closure survive b
From: |
Chicken Trac |
Subject: |
Re: [Chicken-janitors] #1297: variables defined inside closure survive beyond closure! |
Date: |
Thu, 09 Jun 2016 02:39:21 -0000 |
#1297: variables defined inside closure survive beyond closure!
-----------------------------+---------------------------------
Reporter: ai-artisan | Owner:
Type: change request | Status: new
Priority: minor | Milestone: someday
Component: core libraries | Version: 4.11.0
Resolution: | Keywords: closure scope begin
-----------------------------+---------------------------------
Changes (by evhan):
* priority: critical => minor
Comment:
Internal definitions are only valid at the start of a body (see
[http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-8.html#%_sec_5.2.2
R5RS]). You have definitions in invalid locations ({{{begin}}} does not
open a body), which CHICKEN allows but treats as global assignments.
The following, where internal definitions are correctly placed, prints 123
as you expect:
{{{
(define test
(lambda ()
(if r
(begin
(set! r #f)
(let ()
(define v 123)
(test)
(display v)
(newline)))
(let ()
(define v 234)))))
}}}
--
Ticket URL: <http://bugs.call-cc.org/ticket/1297#comment:1>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.