Re: [RFC DISCUSSION] typeof

From: Date: Sat, 04 Jun 2016 17:09:06 +0000
Subject: Re: [RFC DISCUSSION] typeof
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-93772@lists.php.net to get a copy of this message
Hi Richard, I can't review the implementation, but the RFC looks good - great initiative! The only thing I would comment on, is the idea of packing essentially two different functions into one - by default, the return value is a machine-friendly type-name, but the $extended argument turns it into a different function altogether, producing a human-readable type-description. It seems like you have two functions in one, and I personally would prefer having two functions. Other than that, this looks like a nice replacement for e.g. this lengthy switch-statement: https://github.com/mindplay-dk/readable/blob/master/src/readable.php#L30 Incidentally, this library creates "more readable" representations of e.g. closures, displaying filename and line number, which would be another nice-to-have, and another good reason to separate the human-readable function from the machine-friendly function. (I wrote this library mostly to create readable representations of e.g. invalid arguments so I can throw exceptions with more helpful messages - it would be great if that was no longer necessary.) On Sat, Jun 4, 2016 at 2:12 PM, Fleshgrinder <php@fleshgrinder.com> wrote: > Hi all! > > I prepared my first contribution to internals: > > https://github.com/php/php-src/pull/1932 > > I would like to discuss the proposed new function here. I directly went > on and implemented it for the learning experience. I also prepared the > RFC, but as a Gist because I do not have Karma yet: > > > https://gist.github.com/Fleshgrinder/6942daaae32372876e5219998e5e418c > > There are a few open issues (see Gist) that require discussion and of > course a code review of the pull request. > > -- > Richard "Fleshgrinder" Fussenegger > >

« previous php.internals (#93772) next »