On 21 Oct 2002, Raymond Toy wrote:

> 
> I don't know if it's legal to define functions inside a function, and
> whether this is a CMUCL bug or not, but perhaps you could explain why
> you think you need to do this and what you really want to do.
> 

Looks that it is (as far as I understand the standard).  The closure is
closed in the local environment and then put into SYMBOL-FUNCTION cell.
This trick is used often to hide some variables in the Scheme style, e.g.
function (MAKE-ACCOUNT initial-money) could create two functions DEPOSIT 
and WITHDRAW, both closed locally in its body to have access to hidden
local variable containing current balance.

I think macros in particular (and generally compilation) may cause a lot 
of complications here, because compiler would have to preserve 
the environment in which such functions are closed (so calling compile
over local functions could violate "Be nice to compiler writer" 
principle).

Just random remarks,

Zbyszek Jurkiewicz



Reply via email to