RE: [PHP-DEV] Change in type-hint representation

From: Date: Wed, 11 Jan 2017 18:41:28 +0000
Subject: RE: [PHP-DEV] Change in type-hint representation
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-97696@lists.php.net to get a copy of this message
Hi Dmitry, > -----Original Message----- > From: Dmitry Stogov [mailto:dmitry@zend.com] > Sent: Wednesday, January 11, 2017 1:08 PM > To: PHP internals list <internals@lists.php.net>; Bob Weinand > <bobwei9@hotmail.com>; Joe Watkins <pthreads@pthreads.org> > Cc: Zeev Suraski <zeev@zend.com>; Anatol Belski (ab@php.net) <ab@php.net>; > Nikita Popov <nikic@php.net>; Xinchen Hui <xinchen.hui@roguewave.com> > Subject: [PHP-DEV] Change in type-hint representation > > Hi, > > > 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 > > > The main changes are in zend_types.h and zend_compile.h, the rest is just an > adoption for new type representation. > > I don't think we need RFC, because this is just an internal change that doesn't > change behavior. > > > I got the idea working on typed properties together with Bob and Joe. > > https://github.com/php/php- > src/compare/master...bwoebi:typed_ref_properties > > I think it would be better to introduce zend_type and then continue work on > typed properties. > I just did a test compilation and everything looks good. There's one place in ext/com_dotnet/com_handlers.c:305 that would require an adaptation. In this regard a question - would possibly a universal macro make sense, to change the "null allowed" mask ? Also, a macro to change the type, with/without changing the null allowed mask. Just as an API extension to ease the consumer code. I mean, clear, it'd be doable with just a bit more effort, but an API could be handier also for the future compatibility, should the implementation change. For the rest IMO - very elegant approach giving base to facilitate arbitrary types. I also think RFC were a waste of time. Thanks everyone involved! Regards Anatol

« previous php.internals (#97696) next »