RE: [PHP-DEV] Concern around growing complexity in engine - hash table specifically
| From: | François Laupretre | Date: | Thu, 09 Apr 2015 14:16:00 +0000 |
| Subject: | RE: [PHP-DEV] Concern around growing complexity in engine - hash table specifically | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-85756@lists.php.net to get a copy of this message | ||
> De : Anthony Ferrara [mailto:ircmaxell@gmail.com]
>
> If we were using a pure abstraction (only accessing the hash table
> information through the public API), then fine because it's isolated.
> However, many extensions and even places in core access hash table
> structure directly (as can be seen by the updates needed by
> https://github.com/php/php-
> src/commit/2b42d719084631d255ec7ebb6c2928b9339915c2).
> Meaning the complexity isn't encapsulated.
IMHO, that's the main problem. If a piece of code is accessed through an official published API
only, its internal complexity can grow, provided the API still provides the same services. So, the
first step should be to define and publish an 'official' full-featured API.
Phpinternalsbook.com is a fine place for this. The question is what we do for PHP 5 : do we publish
a PHP7-only API ? Do we backport it to 5.6, 5.5, 5.4 ?
Once we have an API, we can fix the code to use it exclusively. One way I already used to check zval
access is through an additional configure option that modifies the field names in the structure so
that any access outside the API fails at compile time. This can be a valuable tool for extension
developers.
If you think the same, I'd be glad to participate.
Regards
François