From: Kevin Ryde <user42@zip.com.au>
Cc: guile-devel@gnu.org
Subject: Re: let-values, and-let* no variables
Date: Tue, 07 Sep 2004 10:12:25 +1000 [thread overview]
Message-ID: <87llfney3a.fsf@zip.com.au> (raw)
In-Reply-To: ljk6vut866.fsf@troy.dt.e-technik.uni-dortmund.de
[-- Attachment #1: Type: text/plain, Size: 593 bytes --]
Marius Vollmer <marius.vollmer@uni-dortmund.de> 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.
[-- Attachment #2: optargs.scm.begin.diff --]
[-- Type: text/plain, Size: 1013 bytes --]
--- 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)
[-- Attachment #3: Type: text/plain, Size: 143 bytes --]
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2004-09-07 0:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-20 1:27 let-values, and-let* no variables Kevin Ryde
2004-08-20 10:28 ` Marius Vollmer
2004-09-07 0:12 ` Kevin Ryde [this message]
2004-09-21 22:09 ` Marius Vollmer
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=87llfney3a.fsf@zip.com.au \
--to=user42@zip.com.au \
--cc=guile-devel@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.
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).