On Thu, Sep 1, 2016 at 12:04 PM, Fleshgrinder <p...@fleshgrinder.com> wrote:
> On 9/1/2016 8:02 PM, Davey Shafik wrote: > > Hey all, > > > > A while back I brought a small RFC to internals, that proposed a set of > > constants that were specifically for alternative implementations to > > identify themselves as such if they want to conform to the spec. > > > > https://wiki.php.net/rfc/php_engine_constant > > > > There were some folks who didn't like it, but nobody suggested different > > implementations, just didn't feel it was necessary. As such, I'm > planning to > > bring it to a vote next week - this is simply a heads up as it's been a > > while > > and I want to give a chance for any objections other than not wanting it > to > > be voiced before I open it up for voting. > > > > The vote will be a straight 50%+1 yes/no vote. > > > > - Davey > > > > +1 from my side. > > What do you think about including a platform and architecture identifier > too? > > const string PHP_ENGINE_PLATFORM = ''; > > WINDOWS > LINUX > MACOS > CYGWIN > FREEBSD > SOLARIS > ... > > This would solve all the tricks we see in various code bases that try to > determine what platform the current PHP installation is running on, > e.g.: if (DIRECTORY_SEPARATOR === '\\') could be replaced with a more > readable if (PHP_ENGINE_PLATFORM === 'WINDOWS'). > > const string PHP_ENGINE_ARCHITECTURE = ''; > > x86 > x64 > ia64 > arm > ... > > This is not required as often but still needed at some places. This > would allow to replace checks like if (PHP_INT_SIZE === 8) with if > (PHP_ENGINE_ARCHITECTURE === 'x64'). We already have PHP_OS, and architecture is likely too broad to determine specific things like INT size etc. That is, while you may be using things like INT size to determine architecture, the inverse is not necessarily true. I don't think these really fit in with the goal of this RFC, which is more about identifying the spec being implemented in alternative runtimes; while your suggestions would just be part of the spec and would just be in those runtimes like any other feature. - Davey