Re: [RFC] Callable Types

From: Date: Fri, 22 Apr 2016 14:58:18 +0000
Subject: Re: [RFC] Callable Types
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-92646@lists.php.net to get a copy of this message
Aaron Piotrowski wrote on 22/04/2016 15:56:
While this is somewhat off-topic of this particular RFC, since we can already do general type-aliasing with use, use SomeFoo as Foo; perhaps similar syntax could be used for type expressions, eliminating the need for a new keyword. use callable(int, int): int as IntReducer; use array | Traversable as Iterable;
The problem with that is that you might want to export (and then import) a type definition: namespace MyPackage\Types { type Foo as \Symfony\Bar | \Zend\FooBar; } namespace Other { use \MyPackage\Types\Foo as FooType; } That would become terrible confusing if you overloaded the "use" keyword. Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#92646) next »