Mittwoch, 21. Mai 2014

On phpng vs. the int64/size_t RFC and PHP's future

The Next PHP Drama™ is here. Right before the size_t/int64 RFC went into it's voting phase, Zend's Dmitry Stogov sched some light on his 4 months closed-door work, phpng.

What is the size_t/int64 RFC?

It's a (big) patch to the PHP core, cleaning up many type jugglings. Besides it enables 64bit integers (on supported platforms) and big strings by using size_t for string lengths (as used by the standard C library). While I have no vote on RFCs, and not that much insight to the PHP core, this seems to be a really good idea. Plus it has no negative impact on existing applications; only PHP extensions have to be touched/reviewed to make sure they use sufficient data types.
This is not the first approach, but all others failed (the last one to fail was https://wiki.php.net/rfc/size_t_and_int64)

What is phpng?

phpng is another big patch. It changes underlying data structures (strings an dobjects f.e., roughly described in https://wiki.php.net/phpng-int). All PHP extensions need touching (although most are done). In contrast to the size_t patch, work on PDO and other database extensions seems to be somewhat problematic, as is no surprise given the massive internal changes.

My opinion?

I really like the size_t patch. As of now it's still in voting phase, but current status looks like this one finally passes (hooray!). Unfortunately, I guess due to extension touching, most of the core team members voted to have the changes merged into phpng. 
This is, inho, a bad thing. 
On the plus side, both patches require changes to the PHP extensions, so having that change only once is good.
On the other side, having such an important clean-up patch delayed (maybe until 2016?) is definitely bad. I've found no statistics on how many problems the core or extension developers had with type juggling, but even the end user change having 64bit ints on both unixoid and Windows platforms targets the patch for 5.next for me (although I only use Linux64 builds).
 
Don't get me wrong, I really like what Dmitry has done in phpng. But having not the smallest announcement of his work in four months disturbs me. It's not surprising there are people calling Zend the "PHP Core Dictators", given they had a roughly working version as of February. And I see many changes to phpng on the horizon, until only the core type changes are stable - plus another year or so until we see JIT compiling.

Just ranting...

And what if the other core members (that don't work for Zend) stay against Zend's changes? The current PHP License would allow derivates. No one could stop Zend from getting sulky and keep all their optimizations from the Open Source version, and build the "Zend Scripting Language", resulting in the next "compatible" scripting engine...

References: