On 17 Sep 2009, at 3:38 pm, John Cowan wrote:
>> (define a (lambda () b))
>> (define b 2)
>
> Say what??!


Y'know, what I read from this recent discussion is that:

1) People have different expectations of how define[-*] work. Fair
enough.
2) People have different *understandings* of how they work. Which is
worrying.
3) Implementations implement them in different ways, at least some of
which appear to be broken. Which is worrying.

I've mainly sat on the sidelines for this debate, but FWIW, my
feelings are:

It's always pained me that let[*|rec|rec*] and let[*|rec|rec*]-syntax
are different things, so defining a bunch of syntax and non-syntax
bindings together can get messy. Sometimes wrapping a whole new layer
of parens around the body of something rather than just shoving in
some defines and define-syntaxes (if necessary) before the body seems
a bit untidy, so there is some aesthetic advantage to a begin (perhaps
implicit) and a load of defines and define-syntaxes. What I think I
really yearn for is to let[*|rec|rec*] and let[*|rec|rec*]-syntax to
all merge into one construct, which could be begin with local defines
inside, or something that makes definitions (of both macros and
values) and body explicitly separate like a let, but merging all the
different kinds of let into one. And then ditch the top level in the
standard; modules are already single forms, so make programs the same.
And have REPLs as entirely different things that try to ape the
behaviour of the interiors of modules and programs as much as
possible, but are different where required to allow immediate
evaluation.

All of these are fairly major changes, though, so not correct for
standardising in R7RS. For R7RS, I'd be inclined to say "mutual
recursion between syntax and other bindings defined at the top level,
within a module body, and within a begin (implicit or explicit), is
fine as long as it's only amongst members of the set comprised of the
bodies of macros and closures, not expressions that have to be
evaluated at the point of definition, which may not be recursively
defined; and all bindings must be defined before the point in the
source that first forces them to be evaluated".

So, allowed:

...
(define-syntax foo ...bar...)
...
(define bar (lambda (x) ...baz...wibble...))
...
(define-syntax baz ...foo...)
...
(define wibble 10)
...

But not allowed:

(define bar wibble)
(define wibble 10)

...as the definition of bar forces wibble to be evaluated before it's
defined.

ABS

--
Alaric Snell-Pym
Work: http://www.snell-systems.co.uk/
Play: http://www.snell-pym.org.uk/alaric/
Blog: http://www.snell-pym.org.uk/archives/author/alaric/




_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to