Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106253 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 43224 invoked from network); 23 Jul 2019 17:42:07 -0000 Received: from unknown (HELO mail-io1-f43.google.com) (209.85.166.43) by pb1.pair.com with SMTP; 23 Jul 2019 17:42:07 -0000 Received: by mail-io1-f43.google.com with SMTP id j6so7378080ioa.5 for ; Tue, 23 Jul 2019 08:05:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=R+oV4MLEOieCEYJULI4p3msi1JTtjjP8N92Mixbskpw=; b=AhGbhdIdmV9Es5bDZReQ6+WSARB8lIH8LXD7NyZ4xUAA/CAZnjMFSTf4hyNn+3CgH1 gGOdkDEeNPDbDm/UtunG/ieW8jXHvcVTDrVRXD12gH+TlLm+bdi3skgOedonnMFyipTj jK+ukax+kIoho6GlDDZwpRhmrNZcxzTfAvibW4G6/i3FKBhlr2+KycXRHpHUG8To0l+x OxZkLWdolyALOxisL3+VtdzRoXMZjzhJa8e7z9MqukN+D6tGuVm5ye2BwZY5c0F3AUfK iVTv50HU6zf+2XL54+cRNtFVa648MLQKpvhyzmVSkMiz6TpYQFWse/JWrC1lQh0FZGek bI3A== 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; bh=R+oV4MLEOieCEYJULI4p3msi1JTtjjP8N92Mixbskpw=; b=eUwMEWCsY3n7c9i1LE83HGjS8+B4mZ242m6ER31aW6o1JW0IZmu3UDoZ4ufTcpc9we 5nkm6evlNGPa2lkG8OvNUGAy5sQ5/moo3gSJO74DQyIgsSqnnV1PgjZHv2ikDUC0G7Bx fRghgKxDdVLF8sEr5gSmorzlFu/ac4ml5PM9nLueUg4gSGkINUzai1+YTFi7KAS8sCOg KsdIXomaKT29xGTFfuEr8D6hkpcno8TsFCzR8UcNXCVpcSoNNx1b4JA2svXxe3kCaQYv rct2yue3T1GVpRGUA0Lo4icPlowwZGb/7UhQAOxrSwgBhV3Hkc8P0nazaAB/DYpToc+n hFaQ== X-Gm-Message-State: APjAAAWJI+6gqOvAXvSHi2pmnz6oYZBhhnB9+3Y8J6xi0JzSllNlKnqG 7MTux7zooEsTFqV+3uGwLO3VXKKddlFzCGRcZc4= X-Google-Smtp-Source: APXvYqwrp5S5V9BW05d0lwyXRajcPi/EuwG2mOOL4XfRCqWx4QB+R81gtY97ldbByzDyUINAWVLf4SAot6OI4yL7Xk4= X-Received: by 2002:a5e:d80d:: with SMTP id l13mr29471799iok.292.1563894316486; Tue, 23 Jul 2019 08:05:16 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 23 Jul 2019 17:05:05 +0200 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000335326058e5a8555" Subject: Re: [PHP-DEV] Re: Generating arginfo from stub files From: ocramius@gmail.com (Marco Pivetta) --000000000000335326058e5a8555 Content-Type: text/plain; charset="UTF-8" On Tue, Jul 23, 2019 at 5:00 PM Nikita Popov wrote: > On Tue, Jun 18, 2019 at 5:10 PM Nikita Popov wrote: > > > Hi internals, > > > > In PHP 8 it will be possible to add reflectible argument and return type > > information for internal functions (it was previously theoretically > > possible as well, but forbidden by policy for php-src for multiple > reasons, > > which have now been resolved). > > > > It will take quite a bit of effort to add this information for hundreds > of > > builtin functions. I would like to take this chance to improve the way in > > which arginfo structures are specified, and make it more ergonomic and > > future proof. Here is an example of a typed arginfo structure: > > > > ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_alias, 0, 2, > > _IS_BOOL, 0) > > ZEND_ARG_TYPE_INFO(0, user_class_name, IS_STRING, 0) > > ZEND_ARG_TYPE_INFO(0, alias_name, IS_STRING, 0) > > ZEND_ARG_TYPE_INFO(0, autoload, _IS_BOOL, 0) > > ZEND_END_ARG_INFO() > > > > Rather than writing this out by hand, I would like arginfo structures to > > be generated from PHP stub files that contain definitions like this: > > > > function class_alias(string $user_class_name, string $alias_name, bool > > $autoload = true): bool {} > > > > I've created a proof of concept implementation for this at > > https://github.com/php/php-src/pull/4284. Function signatures are > > specified in a xyz.stub.php file from which xyz_arginfo.h is generated. > > This file can then be included in the implementation. Nothing about the > > arginfo implementation itself changes. > > > > What do you think about providing this mechanism? > > > > Nikita > > > > Any more feedback on this? > > The existing discussion has been mostly around "can we get the type > information from some existing source?" to which the answer is "nope": > Nothing that already exists is accurate enough for php-src. > > Nikita > Would it be too aggressive to have (in the php-src test suite, as a first step) something that ensures that a stub exists for each exposed userland symbol? That would ensure that any newly added symbol or core extension has the matching userland reflectable-ish structure, which later (hopefully, in the years) could lead to having proper reflection on internal symbols... Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ --000000000000335326058e5a8555--