FFI Type Reflection API

php.internals

Dmitry Stogov

5 years ago
Hi, Last week, at a PHP conference, we discussed some missing parts of ext/ffi with one of the most extrimal FFI user - Alexandr Lisachenko. One of the things he is missing is a FFI Type Reflection API. Actually, this is a simple and self-contained feature, that implementation took me a couple of hours. https://github.com/php/php-src/pull/7217 This doesn't touch any existing code in ext/ffi, just add the API that is better visible through stub: https://github.com/php/php-src/pull/7217/files#diff-3651c407d02a2a152d9aba6e484f6ae7f4c2c85fa2992274d76c0e18364c7e6fL75-R96 Unfortunately, PHP-8.1 is closed for new RFC, so we can merge this as a self-contained feature, or wait for the next version. I ask to merge this into PHP-8.1, but won't do this, in case of any objections. Thanks. Dmitry.

Girgias

5 years ago
On Wed, 7 Jul 2021 at 10:31, Dmitry Stogov <dmitrystogov@gmail.com> wrote:
> Hi, > > Last week, at a PHP conference, we discussed some missing parts of ext/ffi > with one of the most extrimal FFI user - Alexandr Lisachenko. One of the > things he is missing is a FFI Type Reflection API. Actually, this is a > simple and self-contained feature, that implementation took me a couple of > hours. > > https://github.com/php/php-src/pull/7217 > > This doesn't touch any existing code in ext/ffi, just add the API that is > better visible through stub: > > https://github.com/php/php-src/pull/7217/files#diff-3651c407d02a2a152d9aba6e484f6ae7f4c2c85fa2992274d76c0e18364c7e6fL75-R96 > > Unfortunately, PHP-8.1 is closed for new RFC, so we can merge this as a > self-contained feature, or wait for the next version. I ask to merge this > into PHP-8.1, but won't do this, in case of any objections. > > Thanks. Dmitry. >
Ideally the array/struct/function CTypes would be subclasses, but if due to time constraints going down this route is impossible, it is still better to have this information available then not at all. So +0.5 on principle (seeing that there already is a naming bikeshed I'm not going to chime in on this aspect). Best regards, George P. Banyard

Joe Watkins

5 years ago
Hi Dmitry, It doesn't make sense to wait another year for this, and since it's self contained it's fine to merge into 8.1 when ready. Cheers Joe On Wednesday, 7 July 2021, G. P. B. <george.banyard@gmail.com> wrote: