Re: I thought this was the one that worked?



On Tue, Aug 01, 2006 at 12:47:50PM +0900, Logan Capaldo wrote:
On Jul 31, 2006, at 11:26 PM, Chad Perrin wrote:

Closure
A "closure" is an expression (typically a function) that can
have
free variables together with an environment that binds those
variables (that "closes" the expression).


In ruby this environment always exists for a block regardless of the
presence of free variables, since the declaration of the variables
that are free in the block can be added after (in time) the creation
of the closure.

I think that depends on what you mean by "creation of the closure" in
this case. Are you talking about the code used to create it, or the
assignment of the return value of the closure's enclosing scope to a
variable?

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
"A script is what you give the actors. A program
is what you give the audience." - Larry Wall

.



Relevant Pages

  • Re: "returning a closure"
    ... there is just the idea that the closure is still ... closed in the environment where it was created: it's free variables ... opposed to the lexical scope that we mostly use nowadays. ...
    (comp.lang.scheme)
  • Re: A question (confusion) about closure
    ... I have a confusion regarding closure and its definition. ... lexical environment n. ... bindings whose names have lexical scope. ... Even a function without free variables could be considered a closure, ...
    (comp.lang.lisp)
  • Re: "returning a closure"
    ... closure" and I don't get it, because i just think of a closure as a ... closed in the environment where it was created: it's free variables ... opposed to the lexical scope that we mostly use nowadays. ...
    (comp.lang.scheme)
  • Compiling Lexical Closures to C
    ... structure for the closure, ... var createSpinner = function{ ... Now how to pass the free variables? ... The compiler using different solutions based ...
    (comp.compilers)
  • Re: I thought this was the one that worked?
    ... Why should we keep trying unnecessarily complex examples that ... closure is a function that refers to free variables in its ... Even if the Ruby block itself contains no reference to free variables, ... the stored lexical context associated with the block does so ...
    (comp.lang.ruby)