Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110888 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 38986 invoked from network); 9 Jul 2020 09:10:30 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 9 Jul 2020 09:10:30 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id AA909180509 for ; Thu, 9 Jul 2020 01:01:35 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00,BODY_8BITS, DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ua1-f41.google.com (mail-ua1-f41.google.com [209.85.222.41]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 9 Jul 2020 01:01:34 -0700 (PDT) Received: by mail-ua1-f41.google.com with SMTP id c7so449682uap.0 for ; Thu, 09 Jul 2020 01:01:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=basereality-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=E1fqRmO/n5C3b+VCszcbxBImxzgGfa/uVtOVPq9hg18=; b=C6SboOMIPxVd3k4A7aVKtgKDEysuU2irrc14BrS4dkez5IcMmhPcesThW1ca+txhTc YGustCpH4DTj9W5bnlQd6TrQlEvBsdXPm1MlGLJXNdbmkAx3T9+JUazcULw1KVCI2DB9 C0fnjzVo0HipBnLWnVVFYe3DsTRpup1tlXTEddUDq8fSgFP+k1/4U22sdEMTaRA70uUf NzhByzgXO38D7HM+W+iX3Dgbd5aF2PmuvxxmL16254VOiQx4MJqFZqZrG3CRd1S/PYuL J0WpDTHJkip4SbIocUc/GfmzlK0Z/UKkEtIcamIMs9jlO+dv8akKw9Kk961tEA7/Mko+ Gt0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=E1fqRmO/n5C3b+VCszcbxBImxzgGfa/uVtOVPq9hg18=; b=H+F/TfgAykCdHddXQSRe3IXUn1RQzLg+Mai9x3bHqJk8HJQKqhS7wzwcKT3YiNqcO7 ACoJduU0WKUV3PyJqE+GQapVN33HVLNvEnj9jw6Cbj0CBCe7Jkz5p9WVeB/tvft9sb43 DpC3kW/CnVnOiQm5FdXbLhmCueFLwaD4qHM8uc1aH4DwkjZ9a35MDUNaZRPk2BqNOgC/ KnUWIwsjjud+rzjbTzmFKO+CpSssrGMaBbipIo3l+DA8uBRPlzWn7pwN7POepu2ewKke v1OXQNRMAlaL6FtUvpHIqInzagMVVQ52WbtxRGl6z5XhG4oPximYvDbHGMsNZoourjeK 9tgA== X-Gm-Message-State: AOAM532dEKKBYo/j6Lk2W/Wi80hWft/3oKTyg8Uh/340ROESbVG4IkXJ v4miOzHN0ZruD9v4El3mcQwKyZqza1+dPQtN6hq6gA== X-Google-Smtp-Source: ABdhPJz1tZ/yBpvLm5xbrrI9dH8xOBtvN1jEbFmckjuar5osxcuFlHq3zPudFDeZnKNJDbLqe4oy9e8EpQ1f5CVd9o8= X-Received: by 2002:ab0:3b2:: with SMTP id 47mr45576343uau.139.1594281690255; Thu, 09 Jul 2020 01:01:30 -0700 (PDT) MIME-Version: 1.0 References: <1594071415.546211499@f420.i.mail.ru> In-Reply-To: <1594071415.546211499@f420.i.mail.ru> Date: Thu, 9 Jul 2020 09:01:19 +0100 Message-ID: To: =?UTF-8?B?0JrQuNGA0LjQu9C7INCd0LXRgdC80LXRj9C90L7Qsg==?= Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] FFI Improvements: Consistency and soliving some problems From: Danack@basereality.com (Dan Ackroyd) On Mon, 6 Jul 2020 at 22:37, =D0=9A=D0=B8=D1=80=D0=B8=D0=BB=D0=BB =D0=9D=D0= =B5=D1=81=D0=BC=D0=B5=D1=8F=D0=BD=D0=BE=D0=B2 wrote: > > I would like to start discussion about the =C2=ABFFI Improvements=C2=BB R= FC. At the moment, I do not have the right to create wiki page, so I post i= t on the github: https://github.com/SerafimArts/php-rfcs/blob/ffi-improvem= ents/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