Re: Resource typehint and return type
| From: | Andrea Faulds | Date: | Wed, 11 Nov 2015 02:21:25 +0000 |
| Subject: | Re: Resource typehint and return type | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-89167@lists.php.net to get a copy of this message | ||
Hi Ben
Ben Scholzen 'DASPRiD' wrote:
Hi guys, I just poked up an RFC and a patch for resource typehints and return types. I'd really like to hear your thoughts about it! RFC: https://wiki.php.net/rfc/resource_typehint Patch: https://github.com/php/php-src/pull/1631Anthony's Scalar Type Hinting with Cast RFC originally had a resource type hint, but it was later removed, and subsequent RFCs have followed its lead in not including a resource typehint. The reason for this is that the resource type is an anachronism from an age in which PHP did not have objects, yet still needed to make certain types of data opaque. The resource type is a type that exists only to shuffle around C pointers between internal functions. It has no semantic value. Because resources are now redundant, given the existence of objects, their time is running out, and they will be replaced at some point. Adding a type declaration for resource would mean that code using it would break if we replace any existing usage of resources with objects, preventing migration away from resource. So, I'm against this RFC. Thanks. -- Andrea Faulds http://ajf.me/