Re: Draft RFC callable types + callable type/function autoloading
| From: | Dan Ackroyd | Date: | Thu, 02 Jul 2020 10:26:17 +0000 |
| Subject: | Re: Draft RFC callable types + callable type/function autoloading | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-110813@lists.php.net to get a copy of this message | ||
On Wed, 1 Jul 2020 at 20:40, Larry Garfield <larry@garfieldtech.com> wrote:
> it would also offer a way to do effectively the same thing
One use-case that would need to be covered for that would be for
callables where you don't know how many parameters there would be in
the callable.
> duplicate functionality needlessly.
Good chance it might still be nice. Not only is the syntax a little
bit nicer imo:
// For some class
class Foo {
public static function quux() {
echo "I am quux";
}
}
// Partial version
[Foo::class, 'quux'](?);
// Dedicated version
$(Foo, quux);
As I find it easier to read, but also avoiding using strings to
reference functions/classes is probably less ambiguous for both humans
and computers.
cheers
Dan
Ack