Subject: Re: NBSQ : newbie basic syntax question
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 2000/03/05
Newsgroups: comp.lang.scheme
Message-ID: <89spf6$hrvkd$1@fido.engr.sgi.com>
Max Hailperin  <max@max.mcs.gac.edu> wrote:
+---------------
| Barry Margolin <barmar@bbnplanet.com> writes:
| > There's no difference for the compiler.  (define (foo a b) ...) is
| > specified to be an abbreviation for (define foo (lambda (a b) ...)), but
| > they mean exactly the same thing.  It's just a stylistic thing.
| 
| One slight exception is that some compilers or interpreters generate
| different (more helpful) debugging information for the abbreviated form.
+---------------

Yes, some do. But in principle, any compiler (or "interpreter" that always
compiles forms before "interpreting" them) *should* be able to associate
the lambda with the name of the variable that's being defined in the second
case, thus both forms *should* give equivalent debugging detail (unless
the implementor simply chooses not to do that).

On the other hand, this will definitely not give helpful debugging hints,
at least not for "foo" & "bar":

	> (define foo #f)
	> (define bar #f)
	> (let ((x (lambda (a b) ...)))
	    (set! foo x)
	    (set! bar x))
	> 

If the compiler stores any name at all with the lambda, it'll probably
be "x"...


-Rob

-----
Rob Warnock, 41L-955		rpw3@sgi.com
Applied Networking		http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673
1600 Amphitheatre Pkwy.		PP-ASEL-IA
Mountain View, CA  94043