Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!oitnews.harvard.edu!purdue!ames!lll-winken.llnl.gov!venus.sun.com!wnoc-sfc-news!sfc-keio-news!mad
From: mad@math.keio.ac.jp (MAEDA Atusi)
Subject: Local functions (was Re: ISO/IEC CD 13816 -- ISLisp)
In-Reply-To: mad@math.keio.ac.jp's message of Thu, 14 Dec 1995 05:35:51 GMT
Message-ID: <MAD.95Dec21181123@tanzanite.math.keio.ac.jp>
Sender: news@sfc.keio.ac.jp
Nntp-Posting-Host: tanzanite.nak.math.keio.ac.jp
Reply-To: mad@math.keio.ac.jp
Organization: Faculty of Sci. and Tech., Keio Univ., Yokohama, Japan.
References: <49u965$948@goanna.cs.rmit.EDU.AU>
	<MAD.95Dec14143551@tanzanite.math.keio.ac.jp>
	<4as2be$ckp@camelot.ccs.neu.edu>
	<19951215T014159Z@arcana.naggum.no>
	<4b35de$ilh@goanna.cs.rmit.EDU.AU>
Date: Thu, 21 Dec 1995 09:11:23 GMT
Lines: 32

This is not very relevant to ISLisp.

>>>>>> "mad" == MAEDA Atusi Kmad@math.keio.ac.jp> writes:
    mad> Local functions are easier to handle in Common Lisp, because they
    mad> cannot be redefined within their scope.  In Scheme, however,
    mad> LETREC-bound variables can be modified with SET!.  So compiler must
    mad> first prove that the value is a procedure at the time of invocation
    mad> before emitting direct call instruction.

>>>>> "will" == William D Clinger <will@ccs.neu.edu> writes:

    will> This is true.  It is also a very easy optimization to implement:
    will> If a LETREC binds a variable to a procedure, and that variable
    will> does not appear on the left hand side of a SET! within its scope,
    will> then the compiler knows not only that that variable is a procedure
    will> throughout its scope, but it also knows the code for the procedure.

>>>>> "ok" == Richard A O'Keefe <ok@goanna.cs.rmit.EDU.AU> writes:

    ok> You do a very cheap pass over the body governed by the declaration in
    ok> question, find that there are no instances of (SET! id ...), and in
    ok> O(n) time you know what you need to know.

So, here's yet another SMOP.  But is it worth doing it?  How many
programmers modify variables bound by LETREC?  I read in Lisp Pointer
about proposal to prohibit assignment to such variables.

;;;  Keio University
;;;    Faculty of Science and Technology
;;;      Department of Math
;;;		MAEDA Atusi (MAEDA is my family name)
;;;		mad@math.keio.ac.jp
