> There's then the question of what kind of object it would return - a
> Closure? Some child or sibling of Closure? What methods could be usefully
> provided?

Yes, it's a closure. I've actually fleshed this out quite a bit, and
there are a few important questions:

 - With methods do you allow unbound closures? `callable("Foo::method")` ?
 - How do you provide a context object? Two parameters? If so, what
order? The object first makes more sense, but that means you have a
string for your first parameter when there is only one, but an object
if there are two. So you put the context second and it's kind of weird
to do `callable("method", $foo)`

Also note that if we had a unified table for properties, methods and
constatns this is vastly simplified:
  -  $foo::method could provide an unbound, scoped closure
  - $foo->method could provide a bound closure

Or you do alternative grammar rules inside of callable, such that
`callable(foo::method)` must would check for a method instead of a
constant.

All in all, I really wish we had unified properties, methods and
constants. It would also have the advantage that if you have a
property of an object that is a callable you could call it with normal
syntax `$foo->property()` instead of having to do things like `$f =
$foo->property; $f()`.

Callable might work, though.

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

Reply via email to