unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Sebastian Tennant <sebyte@smolny.plus.com>
To: guile-user@gnu.org
Subject: Placement of defines
Date: Thu, 18 Dec 2008 17:00:35 +0000	[thread overview]
Message-ID: <hc51quz0.fsf@vps203.linuxvps.org> (raw)

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





             reply	other threads:[~2008-12-18 17:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-18 17:00 Sebastian Tennant [this message]
     [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

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=hc51quz0.fsf@vps203.linuxvps.org \
    --to=sebyte@smolny.plus.com \
    --cc=guile-user@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).