RE: [PHP-DEV] One API to rule them all? (Was: Extension Prepend Files)
| From: | Pierre Joye | Date: | Mon, 12 Jan 2015 04:10:37 +0000 |
| Subject: | RE: [PHP-DEV] One API to rule them all? (Was: Extension Prepend Files) | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-80407@lists.php.net to get a copy of this message | ||
On Jan 12, 2015 10:44 AM, "François Laupretre" <francois@tekwire.net> wrote:
>
> > De : François Laupretre [mailto:francois@tekwire.net]
> >
> > If you agree, I propose this as a base to refine:
> >
> > - Extension exposes only PHP functions and constants (no OO),
> > - Each PHP function argument must accept a scalar, an array, or both
('mixed'
> > case).
> > - one or more PHP function arguments can be optional
> > - PHP function arguments can be passed by value or by reference.
>
> Adding these rules :
>
> - Constant values must be static (cannot be computed during MINIT).
> - During MINIT and MSHUTDOWN, no activity excepts defining/undefining
functions and constants.
> - No activity during RINIT/RSHUTDOWN.
>
> And changing this one :
>
> > - PHP functions return value type can be any scalar type or array.
>
> To:
>
> PHP functions return value must be a fixed type (cannot return different
types depending on context). Return value type can be null, bool, long,
double, string, or array.
>
> The resulting ruleset :
>
> - Extension exposes only PHP functions and constants (no OO),
> - Each PHP function argument must accept a scalar, an array, or both
('mixed' case).
> - one or more PHP function arguments can be optional
> - PHP function arguments can be passed by value or by reference.
> - PHP functions return value must be a fixed type (cannot return
different types depending on context). Return value type can be null, bool,
long, double, string, or array.
> - Constant value must be static (cannot be computed during MINIT).
>
> I have pushed a first half-baked version of the extension generator I was
thinking about. Just for a look, don't try to run it. I started with json
and yaml support for metadata definition. We can easily add another
supported syntax if needed but these should be enough. Look at
https://github.com/flaupretre/php-ext-gen/tree/develop
Would it not be better to work on one only?
Also I am really not a fan of yaml&co to generate C code but having
critical parts in C and everything else in straight php :)
> François
>
>