Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106252 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 41174 invoked from network); 23 Jul 2019 17:37:07 -0000 Received: from unknown (HELO mail-lj1-f172.google.com) (209.85.208.172) by pb1.pair.com with SMTP; 23 Jul 2019 17:37:07 -0000 Received: by mail-lj1-f172.google.com with SMTP id h10so41394831ljg.0 for ; Tue, 23 Jul 2019 08:00: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; bh=NKXkThLVrcbGA9IEvAtzyO79dvHVwheTr57qjVdzFIw=; b=jXQ8oT4qqecpoMkd9q7CvfkQ9HYArgfmpjMw6jX8/7CtlUWe7mdrbdoI8cEiIcNTtl 4/QAjky21zf7dyaZ7MQYUxJyY+VxYPLKo+DYiiEWNSYQie0o7R3Din93/tk4anK+jTk/ hcDbC64yMyY1nwPrjsDmj4BUVGkhdGExi1nbEBbHA6UOugDr2KfXa5bjAQgrCQcIarNj ki6Id4k+ai6CA1iahGZGlij9dV+HOJ6kxKgjn25q3LREVl+jR2TYCBoD9LboWwl7EcWc noUQPrVpZrTTfPwY9tBoD3Jm5378ImTxg0LC/2vZfJMeFfCYIj6WogjotL/11ukKp+yv IGPQ== 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; bh=NKXkThLVrcbGA9IEvAtzyO79dvHVwheTr57qjVdzFIw=; b=e1NVRWCYq3q9dbiRvW4Jq2MTbd74SVo8LuKrEeedgVfnPCZ+ARP0NaSD/6Nzs3wR1S ycYhgSqUCPu1I+TRrWI2PmBn2eMAdGFEw1ngUhH4JUdQUuB63QS1wHGxZuedqFf0TQTv LYSn0or/3I2nDTIAeHl6X5JVbPkXfWyyRkY6SQ4WsT5U/iGbCyj70dkcF5ti8TrFniZj HWiQ6T3KKNt4/KXwvQYysaeTGTn0KoF8FYaiNHKaTHKYj+ARS5+vYiRn9mbvzYVtju3/ UHmLSbHGlK4vdu28q/+j6riNZfoURpbEVj7DYycvZ7rqToAdUo+ildrUEZnO67h7RYSa PMoA== X-Gm-Message-State: APjAAAV9f5rDxx8quPpqKW2fJKlTcnX4isizZcwxte0e/CQLZiopWVXI qFqcYfthB5O9XKZTvOSitRbUqCUF99ZQtCxl+4wwYrxNqu4= X-Google-Smtp-Source: APXvYqzQajWpPvXJ0Rv6ypPeYAGZ6TqYvOs4S9OeIO7Nb0BJALvwJ1LszkJClZGV48DuLY4ZcNpksChoV62Ss+fCvzg= X-Received: by 2002:a2e:8583:: with SMTP id b3mr3734385lji.171.1563894016949; Tue, 23 Jul 2019 08:00:16 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 23 Jul 2019 17:00:00 +0200 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="00000000000058c317058e5a73e6" Subject: Re: Generating arginfo from stub files From: nikita.ppv@gmail.com (Nikita Popov) --00000000000058c317058e5a73e6 Content-Type: text/plain; charset="UTF-8" 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 --00000000000058c317058e5a73e6--