On Mon, 6 Jul 2020 at 22:37, Кирилл Несмеянов <n...@xakep.ru> wrote:
>
> I would like to start discussion about the «FFI Improvements» RFC. At the 
> moment, I do not have the right to create wiki page, so I post it on the 
> github:  
> https://github.com/SerafimArts/php-rfcs/blob/ffi-improvements/rfcs/0000-ffi-improvements.md
>

Thanks for starting this discussion. I think FFI definitely needs to
be improved before it will see widespread adoption.

> Please note that for backward compatibility, allow option with
> passing a string as the second argument to the FFI::cdef() method.

Rather than changing the function signature of FFI::cdef, I think it
would be better to introduce a new function, and then at some point
deprecate and remove the old one (if anyone cares to).

So rather than FFI::cdef() it could be FFI::ghij() or maybe even a
name that is somewhat meaningful.

For FFI_LIB, FFI_SCOPE, and FFI_LIB_DIR your proposal sounds sensible.
It would be really good if someone involved in getting FFI into core
could comment if there was any specific reason for not doing that
already.

One other thing that probably also should be addressed is the
behaviour around closures that was noted in the RFC
https://wiki.php.net/rfc/ffi#php_callbacks:

> It's possible to assign PHP closure to native variable of
> function pointer type (or pass it as a function argument).
> This works, but this functionality is not supported on all libffi
> platforms, it is not efficient and leaks resources by the end of
> request. It's recommended to minimize the usage of PHP callbacks.

I really don't know what can or should be done for that, but having a
feature that can't be used safely seems like a bad feature.

cheers
Dan
Ack

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to