Newsgroups: comp.lang.lisp.franz
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!news.mathworks.com!zombie.ncsc.mil!news.duke.edu!eff!news.umbc.edu!haven.umd.edu!ames!kronos.arc.nasa.gov!usenet
From: bobo@avogadro.arc.nasa.gov (Mark Friedman)
Subject: Re: Labels vs flet optimization
In-Reply-To: aml@poirot.ist.utl.pt's message of 01 Feb 1995 18:36:04 GMT
Message-ID: <BOBO.95Feb10111547@avogadro.arc.nasa.gov>
Lines: 52
Sender: usenet@ptolemy-ethernet.arc.nasa.gov (usenet@ptolemy.arc.nasa.gov)
Nntp-Posting-Host: avogadro.arc.nasa.gov
Reply-To: bobo@ptolemy.arc.nasa.gov
Organization: NASA/Ames Information Sciences
References: <AML.95Feb1193604@sol.ist.utl.pt>
Distribution: inet
Date: Fri, 10 Feb 1995 19:15:46 GMT

In article <AML.95Feb1193604@sol.ist.utl.pt> aml@poirot.ist.utl.pt
(Antonio Leitao) writes:

   Following a recent thread in comp.lang.scheme, I would like to know why
   the Allegro Cl compiler can't optimize a labels in the same way it can
   optimize a flet.

   Check the example:

   (defun foo ()
     (flet ((test (arg)
	      arg))
       #'test))


   (defun bar ()
     (labels ((test (arg)
		(test arg)))
       #'test))

   (they were both compiled)

   USER(1): (eq (foo) (foo))
   T
   USER(2): USER(2): (eq (bar) (bar))
   NIL

But note the following:

USER(19): (defun foo ()
	    (flet ((test (arg) arg))
	      (flet ((test (arg)
		       (test arg)))
		#'test)))
FOO
USER(20): (compile 'foo)
FOO
NIL
NIL
USER(21): (eq (foo) (foo))
NIL

-Mark
-- 
--
Mark Friedman
NASA-Ames Research Center
MS 269-2
Moffett Field, CA 94035-1000

vmail: (415) 604-0573
email: bobo@ptolemy.arc.nasa.gov
