Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89167 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17977 invoked from network); 11 Nov 2015 02:21:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Nov 2015 02:21:33 -0000 X-Host-Fingerprint: 90.204.80.47 unknown Received: from [90.204.80.47] ([90.204.80.47:29554] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/FC-21426-A26A2465 for ; Tue, 10 Nov 2015 21:21:32 -0500 Message-ID: To: internals@lists.php.net References: <56429DAB.6010005@dasprids.de> Date: Wed, 11 Nov 2015 02:21:25 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:41.0) Gecko/20100101 Firefox/41.0 SeaMonkey/2.38 MIME-Version: 1.0 In-Reply-To: <56429DAB.6010005@dasprids.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 90.204.80.47 Subject: Re: Resource typehint and return type From: ajf@ajf.me (Andrea Faulds) 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/