[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: let-values, and-let* no variables
From: |
Kevin Ryde |
Subject: |
Re: let-values, and-let* no variables |
Date: |
Tue, 07 Sep 2004 10:12:25 +1000 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux) |
Marius Vollmer <address@hidden> writes:
>
> Uhh, intuitively I'd say that this is wrong behavior.
One that's guile specific is let-optional and let-keywords, eg.
(use-modules (ice-9 optargs))
(let ()
(let-keywords '() #f ()
(define localvar 123))
localvar)
=> 123
which could be fixed fairly easily,
* optargs.scm (let-optional-template, let-keywords-template): Change
"(begin body)" to "(let () body)" for empty bindings, since the former
lets syntactically internal defines in body leak out to the
surrounding environment.
--- optargs.scm.~1.20.~ 2003-04-07 08:04:58.000000000 +1000
+++ optargs.scm 2004-09-07 09:16:29.000000000 +1000
@@ -1,6 +1,6 @@
;;;; optargs.scm -- support for optional arguments
;;;;
-;;;; Copyright (C) 1997, 1998, 1999, 2001, 2002 Free Software Foundation,
Inc.
+;;;; Copyright (C) 1997, 1998, 1999, 2001, 2002, 2004 Free Software
Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -125,7 +125,7 @@
(define (let-optional-template REST-ARG BINDINGS BODY let-type)
(if (null? BINDINGS)
- `(begin ,@BODY)
+ `(let () ,@BODY)
(let-o-k-template REST-ARG BINDINGS BODY let-type
(lambda (optional)
`(,(car optional)
@@ -140,7 +140,7 @@
(define (let-keywords-template REST-ARG ALLOW-OTHER-KEYS? BINDINGS BODY
let-type)
(if (null? BINDINGS)
- `(begin ,@BODY)
+ `(let () ,@BODY)
(let* ((kb-list-gensym (gensym "kb:G"))
(bindfilter (lambda (key)
`(,(car key)
- Re: let-values, and-let* no variables,
Kevin Ryde <=