Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105970 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 97877 invoked from network); 18 Jun 2019 17:55:52 -0000 Received: from unknown (HELO mail-lf1-f52.google.com) (209.85.167.52) by pb1.pair.com with SMTP; 18 Jun 2019 17:55:52 -0000 Received: by mail-lf1-f52.google.com with SMTP id b11so9586006lfa.5 for ; Tue, 18 Jun 2019 08:10:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=wsGW754nqMheZJICl/r9HfSfCu5oMETgYdQaNU9o9IU=; b=tTccf1R0qqDMU8MiTUs9yE8OaLJL1/HMd7Zqtf8AVAiXqsjVT+Q07gkuFLGYL5jl2w 5KgvKblX3glzRFFyBw83xpaxJcoR7K6oaPkjJQF7s4uu0CmKbrZB1uF/XwvUw2IQiDdb Gtzd2SO5rnpRZw/+z1HtYgTSeLkS/EFz33ShLtFsTYUtiwWlIckFsjQXTo5yh8hmXPTW 0CWsCjU/QUE6lKvXtH+ACNTQ3+xyiIP9BFjib27JNWuO2HQmX+pY3qAe+B5eBD/lTboW NnCHtkZzoKgXuGADt8qNXbfGWL/scCzUOQGqmTDU/Y/vOB9T6MLq/b3g90eSLxfNR6fd 2UDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=wsGW754nqMheZJICl/r9HfSfCu5oMETgYdQaNU9o9IU=; b=XSeRhZw6W2zGzNbHeCZ/2T1/2HwEJ6mzFLdtqrEuNnukgHleUw/ZtOs5fDcDIUivFq FQK9NCvN2clbuzAojbBJ0W21LWonJt9RCaEUYy1Y9eaLQevFIGYMqFM+JYt/Bbi76MRY K3opbFvtH2XLs+RtbOeQfOeddWOXdAFU8qbcOLNEa8adUUYCCEgVHL5ACGwpto0iQI8l niArJop6QTM/ja5FKJ42eGaelw2XBI93yLb+RRYDaH4D4fy9jysDsNlVuIsexUdo5gqX 3QNvX+kU9YYVjrcqBYQiYNqigBaG+KUvgBdPgyFw1JKdMwYpwmCQO+uUARF/xMimNwxQ T+wQ== X-Gm-Message-State: APjAAAXo3lZt6Dh8sSyjjaHlGeUMlC4MaQ7dTihNsWVZtBhstn/liRby BRJzOq+e1qpf9IF1Ih2fopGwD5mcgJ043PxJLTzTP4Ieo3Q= X-Google-Smtp-Source: APXvYqz06oKHhTIcsu4S/xSgf4USlZ+wcGDYnRD/50OsQDCIKzepmh+hETN+g69PSQnq5HoYrZKAVnvG2OIdQKFJgbM= X-Received: by 2002:ac2:44b1:: with SMTP id c17mr11153458lfm.87.1560870616920; Tue, 18 Jun 2019 08:10:16 -0700 (PDT) MIME-Version: 1.0 Date: Tue, 18 Jun 2019 17:10:01 +0200 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000a9765b058b9a825b" Subject: Generating arginfo from stub files From: nikita.ppv@gmail.com (Nikita Popov) --000000000000a9765b058b9a825b Content-Type: text/plain; charset="UTF-8" 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 --000000000000a9765b058b9a825b--