xp-framework/rfc — Issue #209: RFC 0209: Callable type
Author: thekid
Created: 2011-10-17 16:09:46+00:00
State: open
Labels: framework, language

There should be a way to denote function / callable / lambda types in sourcecode and apidocs. An example would be the following function inside e.g. an arrays utility class:

```php

```

Now `$func` can be for PHP one of the following:

* A string containing a function name
* An array containing an class name and static method name
* An array containing an instance and a method name
* An anonymous function created with `create_function()`
* (as of 5.3) : An anonymous function created with `function(...) { ... }` syntax
* (as of 5.3): Any object with an `__invoke()` magic method

See http://de3.php.net/manual/en/language.pseudo-types.php

A type class in the lang package should accompany this new type syntax and literal.

See also: http://cr.openjdk.java.net/~briangoetz/lambda/lambda-state-3.html