RE: [PHP-DEV] Annotated PHP 5->7 extension diff
| From: | François Laupretre | Date: | Sat, 07 Feb 2015 02:57:57 +0000 |
| Subject: | RE: [PHP-DEV] Annotated PHP 5->7 extension diff | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-82077@lists.php.net to get a copy of this message | ||
> De : Pierre Joye [mailto:pierre.php@gmail.com]
> What do you think about the creation of an example extension covering
> almost everything one would do in an extension?
>
> The class, methods or functions do not have to be useful but to have simple
> clear examples to display the differences with extensive comments.
>
> Doing so has the big advantage of being self contained and anyone can
> contribute easily. It is also easier for someone to actually play with it
> than with a diff.
Maybe php-ext-gen can be useful here. It is a PHP extension generator I just wrote, with the
objective to avoid splitting extension source trees to two independent branches, as differences
between PHP 5 & 7 are beyond what macros can do. The other objective is to make it easier to
write a typical 'bridge' extension without knowing much to the PHP API (without
manipulating any zval). It could be an ideal environment for an example extension.
The current version already abstracts and generates code for argument parsing, return types, ini
settings, resources, functions, constants. The source for this is a Yaml or Json synthetic
description and C code reduced to the bare minimum.
It is based on pluggable generators, the primary scope being PHP5, PHP7, and HHVM. Currently, the
only implemented generator is PHP 5, but PHP 7 will be easy to implement (it is based on twig
templates).
The project is at https://github.com/flaupretre/php-ext-gen. Look
in the examples subdir, the wiki, and tell me what you think.
Cheers
François