Re: One API to rule them all? (Was: Extension Prepend Files)

From: Date: Mon, 12 Jan 2015 05:50:21 +0000
Subject: Re: 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-80408@lists.php.net to get a copy of this message
On Sun, Jan 11, 2015 at 7:44 PM, François Laupretre <francois@tekwire.net> wrote: > - 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). > Why so limited? Like, why disallow objects completely? That feels like a big step backward for PHP. Any why not computed constants? (Assuming they stay constant throughout the process lifetime) > 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 > I'll be honest, I'm not a big fan of code-generation. I find it introduces complexity and it's not needed here. Lots of languages manage to put together a stable API without resorting to code generators. -Sara

« previous php.internals (#80408) next »