For the record, I do like this syntax, but it COULD be rewritten using
current practices (see below).

That's a good point - actually most uses of closures could be with some effort rewritten as classes. The difference would be that in case of closures, closure chooses which parts of context to import, and in case of objects you would need to explicitly supply the parameters. Also, you'd have to explicitly call the object methods, can't just do $foo(). And of course it's not as slick and generic as closure - you'd have to write new class for each case.

class SortByKey implements Callable {
...
$Sorter();

Well, you can do it now by using call_user_func(), and you also have advantage of using more than one function per class :) So I'm not sure it's necessary.
--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to