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/1631

Anthony'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/

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

Reply via email to