unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
[parent not found: <cmu-lmtpd-21674-1229672512-0@mail-imap1.uio.no>]
* Placement of defines
@ 2008-12-18 17:00 Sebastian Tennant
  0 siblings, 0 replies; 7+ messages in thread
From: Sebastian Tennant @ 2008-12-18 17:00 UTC (permalink / raw)
  To: guile-user

Hi all,

Having read this interesting thread:

 http://sourceware.org/ml/guile/1999-08/msg00118.html

I understand that internal definitions may not occur anywhere other than
at the beginning of the body of the enclosing expression, which explains
why this works:

 ((lambda (x) (define bar x) (display bar)) "foo\n")

while this doesn't:

 ((lambda (x) (set! x "baz\n") (define bar x) (display bar)) "foo\n")

Firstly, perhaps this could/should be mentioned in the manual?

(info "(guile) Internal Definitions") currently reads:

"A `define' form which appears inside the body of a `lambda', `let',
 `let*', `letrec' or equivalent expression is called an "internal
 definition"."

May I suggest this reads:

"`Define' forms may only appear at the beginning of the body of a
 `lambda', `let', `let*', `letrec' or equivalent expression, and when
 they do they constitute what are known as "internal definitions"."

or words to that effect.

Secondly, there is some talk in the above-mentioned thread of an
extension to R5RS Scheme that allows define forms to occur anywhere
within the body of the enclosing expression, making for much more
readable code.

The thread is approx 8.5 years old now, and I was just wondering why the
extension never made it into Guile, the readable code argument being a
pretty compelling one IMHO.

Sebastian





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-12-27 15:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cmu-lmtpd-18264-1229620135-1@mail-imap1.uio.no>
2008-12-18 17:31 ` Placement of defines Kjetil S. Matheussen
2008-12-18 18:47   ` Sebastian Tennant
2008-12-18 20:57     ` Ludovic Courtès
2008-12-19 11:18       ` Sebastian Tennant
     [not found] <cmu-lmtpd-21674-1229672512-0@mail-imap1.uio.no>
2008-12-19 17:10 ` Kjetil S. Matheussen
2008-12-27 15:19   ` Sebastian Tennant
2008-12-18 17:00 Sebastian Tennant

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).