[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CScheme question



I recently started using CScheme, and I have a question about the
efficiency of the compiler.  When writing macros, a common idiom I use
is:
 `(lambda ,args
   (let (,@(and var1
	        `((,var1 ,(generate-uninterned-symbol))))
         ,@(and var2
	        `((,var2 ,(generate-uninterned-symbol))))
	 ...)
     ...))
where temporary variables are gensymed only if they are needed.  If no
variables are needed, what comes out is
  (lambda (x y z)
    (let ()
      ...))  

Now in any other lisp/scheme the internal let binding would be
discarded.  In CScheme, it would seem that the internal environment
would have to be created because of the way define works.  I use this
idiom a lot, and wind up with functions that pp as (let () (let ()
...)).  My question is: is the compiler smart enough to realize that
no defines occur in the body, and so no environment is needed, or do I
have to make macros condition on the presence/absence of temporary
variables?

---
Evan Kirshenbaum
Stanford University
  evan@CSLI.STANFORD.EDU
  ...!{ucbvax,decvax}!decwrl!glacier!evan

If you think my opinions represent this university, 
you haven't been on campus recently!