Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97709 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40649 invoked from network); 11 Jan 2017 22:40:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jan 2017 22:40:00 -0000 X-Host-Fingerprint: 95.144.152.155 unknown Received: from [95.144.152.155] ([95.144.152.155:3733] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 68/E1-30525-044B6785 for ; Wed, 11 Jan 2017 17:40:00 -0500 Message-ID: <68.E1.30525.044B6785@pb1.pair.com> To: internals@lists.php.net References: Date: Wed, 11 Jan 2017 22:39:56 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:49.0) Gecko/20100101 Firefox/49.0 SeaMonkey/2.46 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 95.144.152.155 Subject: Re: Change in type-hint representation From: ajf@ajf.me (Andrea Faulds) Hey Dmitry, Dmitry Stogov wrote: > I propose to introduce a unified type representation (zend_type). > > Now it's going to be used for typing of arguments and return values. > > Later we should use it for properties and other things. > > > https://gist.github.com/dstogov/1b25079856afccf0d69f77d499cb0ab1 I like this proposal, particularly how it's more compact than our existing representation. One comment: it appears that these zend_type values can encode both pointers to strings (class names) and pointers to class entries, right? How do you know whether a given zend_type value is one or the other? Should you just know from context? (It looks like ZEND_TYPE_CE() is in fact unused right now…) On a related note, look at this portion of the diff: + if (ZEND_TYPE_IS_SET(info->type)) { + if (ZEND_TYPE_IS_CLASS(info->type)) { + const char *type_name = (const char*)info->type; Is this a type confusion between zend_string* and const char*? Thanks! -- Andrea Faulds https://ajf.me/