Re: [PHP-DEV] On closures and lamdba

2010-02-25 Thread Keryx Web
Just when I thought that this discussions was dying 2010-02-23 22:50, Stanislav Malyshev wrote: Everybody on the internet knows that Wikipedia is the ultimate source of knowledge, and it says: In computer science, a closure is a first-class function with free variables that are bound in the

Re: [PHP-DEV] On closures and lamdba

2010-02-24 Thread Ionut G. Stan
On 2/24/10 8:56 AM, Stanislav Malyshev wrote: Hi! Correct me if I'm wrong, but given the fact that PHP only* supports functions defined in the global space**, with the additional ability to import global variables using the global statement, wouldn't that make named functions able to

Re: [PHP-DEV] On closures and lamdba

2010-02-23 Thread Stanislav Malyshev
Hi! My question is not so much about implementation it is about language. I have noticed quite a few times now that PHP developers use the word closure when I would prefer lambda. Everybody on the internet knows that Wikipedia is the ultimate source of knowledge, and it says: In computer

Re: [PHP-DEV] On closures and lamdba

2010-02-23 Thread Ionut G. Stan
This is not entirely correct, you are right. There's a difference between anonymous function and closure, though in practice in PHP anonymous functions are closures (though some of them are rather trivial ones with no variables to close over) and that's now the only way to do closure in PHP (i.e.

Re: [PHP-DEV] On closures and lamdba

2010-02-23 Thread Larry Garfield
On Tuesday 23 February 2010 05:00:28 pm Ionut G. Stan wrote: This is not entirely correct, you are right. There's a difference between anonymous function and closure, though in practice in PHP anonymous functions are closures (though some of them are rather trivial ones with no variables

Re: [PHP-DEV] On closures and lamdba

2010-02-23 Thread Stanislav Malyshev
Hi! Correct me if I'm wrong, but given the fact that PHP only* supports functions defined in the global space**, with the additional ability to import global variables using the global statement, wouldn't that make named functions able to close-over global variables? It's different mechanism.

Re: [PHP-DEV] On closures and lamdba

2010-02-23 Thread mathieu.suen
Stanislav Malyshev wrote: Hi! My question is not so much about implementation it is about language. I have noticed quite a few times now that PHP developers use the word closure when I would prefer lambda. Everybody on the internet knows that Wikipedia is the ultimate source of knowledge,

Re: [PHP-DEV] On closures and lamdba

2010-02-21 Thread Keryx Web
2010-02-21 03:55, Joey Smith skrev: There's a pretty big difference between how PHP implements closures and how JavaScript implements them I have seen that, but my question is about language, not implementation. FWIW, taking my educator perspective, PHP's way of explicitly pointing out what

Re: [PHP-DEV] On closures and lamdba

2010-02-20 Thread Keryx Web
2010-01-19 17:05, Stanislav Malyshev skrev: I honestly don't see func()()()() make anything better in the world of a PHP programmer. You probably don't use closures, right? Sorry for kidnapping a thread, bit it was this message that got me thinking about raising the issue in earnest. I'm

Re: [PHP-DEV] On closures and lamdba

2010-02-20 Thread Joey Smith
Oh, yes, the question: Wouldn't you agree that it is better for PHP to use the word closure as it is being used in the JavaScript community? There's a pretty big difference between how PHP implements closures and how JavaScript implements them - in PHP, you have to explicitly request which

Re: [PHP-DEV] On closures and lamdba

2010-02-20 Thread Ionut G. Stan
So to answer your question, for my money, since I can't currently tell the difference in a programmatic way between an 'anonymous function' and a full 'closure', I don't find it that worrisome that the PHP world somewhat conflates the two terms. For me it's worrisome because future developers,