PHP gets Lambda

« previous entry | next entry »
Mar. 12th, 2009 | 04:45 pm

PHP has always had a hackish way to support first-class functions by making it possible to assign anonymous functions with create_function and run them with any functions that support callbacks (See array_map).

PHP 5.3 (unreleased as of 2009-03-12) will introduce Lambda functions and closures. I'm not really sure if the implementation is sound or complete, but I'm sure there are enough functional programming language implementations and progammers to make sure its *doing the right thing*. I'm very glad because I was afraid PHP was going to be steered backwards by opinions like this.

See also IBM Developer Works, which had an article on these forthcoming features in What's new in PHP V5.3, Part 2: Closures and lambda functions.

Someone asked recently what the design philosophy of PHP was. I had to say, "PHP was meant to be a server-side include system for HTML documents with a Perl syntax. It's been trying to outrun its heritage ever since."

Link | Leave a comment | Share

Comments {0}