Re: Change in type-hint representation
| From: | Andrea Faulds | Date: | Wed, 11 Jan 2017 22:39:56 +0000 |
| Subject: | Re: Change in type-hint representation | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-97709@lists.php.net to get a copy of this message | ||
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/1b25079856afccf0d69f77d499cb0ab1I 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/