[Top][All Lists]

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

Re: Return

From: Fren Zeee
Subject: Re: Return
Date: Wed, 22 Dec 2010 21:39:30 -0800

On Fri, Dec 10, 2010 at 12:28 AM, Stephen J. Turnbull
<address@hidden> wrote:
> Stefan Monnier writes:
>  > >> > There are lots of reasons for doing a defun inside of a function.
>  > >> Give me examples and I'll tell you if I consider them as
>  > >> valuable enough.
>  > > Anything you would use `require' for inside a function.  Betcha find a
>  > > dozen or more instances of require-in-a-function in Gnus alone.
>  >
>  > Irrelevant: the defuns in the loaded file are defined at the top-level
>  > even if the require is called from within a function.
> Irrelevant: the defuns in the function are defined at the top-level
> even though defun is called from within a function.

In this case it is helpful to allow nested defuns.

Most code is developed in build-fix method as Paul Graham has
explained very well.

For making modules, one puts simply a wrapper and want the minimal to
edit and move things around. An auxilary function then gets nested. I
do this often in a language that is lisp under a different label.

> My point is that you could just as well do the defuns inside the
> function as in a require'd file.  Much of the time it makes sense to
> split them out into a file, of course, but I don't see any good reason
> why that should be enforced if the author would prefer to put her
> defuns in a function.
> defun is always at top level, right?  If I want a local function
> (which I do quite frequently) I use flet.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]