Re: [PHP-DEV] RFC: Removing the Zend API
Paul Biggar <paul.biggar <at> gmail.com>
2009-04-01 13:24:19 GMT
On Tue, Mar 31, 2009 at 9:23 PM, Nuno Lopes <nlopess <at> php.net> wrote:
> Hi Paul et all,
>
> I fully understand (and even share) your motivations and goals. However it
> seems to me that describing an extension in PHP will lead to loss of
> performance, as you cannot capture certain C features in PHP. For example,
> there are some internal functions that rely on pointer arithmetic to get
> decent performance.
This is not about capturing every C feature. Instead, it is about
strictly separating the C and PHP code. If someone wants to C pointer
arithmetic, it is simple to code it on the C side of the line. Its not
necessary to expose the exact C function from the library. Sometime,
you may wish to to have a C function wrapping it, to do some "dirty
tricks".
> Then you may extend to PHP to better capture these "dirty tricks", and then
> you'll end up with some DSL for building PHP extensions. It's not
> necessarily bad, it's just a lot of work.. :)
This - which I'll call the Pyrex model - is one way to go, but its not
my preference. While I think it beats the current model, I hope that
it won't be required with whatI propose in the RFC.
> Moreover, in your example in the wiki you don't include how you would do
> parameter parsing. Or do you rely on the code generator to look at the C
> functions signatures and figure out by itself what to do? (actually there is
> some ambiguity, AFAIR, and thus guessing cannot be done reliably)
That is exactly right. (I'll make this clearer in the RFC). I can't
(Continue reading)