Brainfade time - what's the proper name for a 'local' handler?

Jeff Massung massung at gmail.com
Thu May 27 11:15:51 CDT 2010


On Thu, May 27, 2010 at 10:57 AM, Mark Stuart <mstuart at adaptcrm.com> wrote:

>
> In other languages like JavaScript and Scheme that sort of thing is
> referred to as a closure - here's an example from Wikipedia:
>
>   // Return a list of all books with at least 'threshold' copies sold.
>   function bestSellingBooks(threshold) {
>     return bookList.filter(
>         function (book) { return book.sales >= threshold; }
>       );
>   }
>
>
This is what's known as a lexical closure. It's a first-class function
that's created on the fly and whose data is bound to a lexical environment.
Difficult to explain, but very powerful, and Rev does not have support for
them. Very few languages do (think Lisp, Scheme, JavaScript, and probably a
dozen others), but the count is growing. Many languages that claim closures
actually don't support them, but simulate them functionally (which is very
different). But that's another discussion outside this scope.

You should ask yourself if you really need this feature to accomplish your
end-goal. Most likely the answer is "no," even if it might make things
easier for you. What exactly is it you want to do? I'm sure you'll get a
plethora of suggestions from people here itching to solve a problem and
write some code in Rev. ;-)

Jeff M.



More information about the use-livecode mailing list