From: Brian Candler Date: 2012-02-21T07:23:10+09:00 Subject: Re: How are closures implemented? Ralph Shnelvar wrote in post #1047769: > How are closures implemented? How does the closure know about its > environment? The closure *is* the environment. Are you familiar with local variables allocated on a stack? Then instead imagine stack frames allocated out of the heap, in a linked list. Instead of being deallocated at the end of a function, they are garbage-collected when there are no more references to them, just like any other object. -- Posted via http://www.ruby-forum.com/.