Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115281 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 97551 invoked from network); 3 Jul 2021 13:30:09 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Jul 2021 13:30:09 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D3B5518054D for ; Sat, 3 Jul 2021 06:51:08 -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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,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-oi1-f182.google.com (mail-oi1-f182.google.com [209.85.167.182]) (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 ; Sat, 3 Jul 2021 06:51:08 -0700 (PDT) Received: by mail-oi1-f182.google.com with SMTP id l26so12425790oic.7 for ; Sat, 03 Jul 2021 06:51:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ralphschindler-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=0F0pGypb6cQpDw7GH8F2Zckj5B8D/filUvCT8z8ml1o=; b=T1Ml8oFr3tVjn2hf4s+hp7cPmjsc6y8CTqEyGitFUvaq1/vGYEZ+6f6FjOfk9at0Ov 2qOfbGkUR8jZ6OIVuBr39UrP5tqUFR1qUq9iGvFyT4QQQfxJtqSDKU/tYI3fZtO/Q/MR CuiR3WQzWUNuQU+XqaAHxl0WPcxdgfv48JASVKFnwCj3KpjayvOJG17oOOphokXTyWes +k20k/3SY1Yjavjb+1Mfobqp0HwRWhWXziwjZ4aluyJ+2nL/js2G0yIcwRfNLvViNheP y+bQPA7BRrzZkKECb0kgItv4QfpVVIAWirTWfaHv7i+VX17DXUzQmecovOOgGRN5e1aO XVpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=0F0pGypb6cQpDw7GH8F2Zckj5B8D/filUvCT8z8ml1o=; b=UMyFatdDYW8S/LhLdoL6WtpUb193BzMVdD2CfVshbpzl1FKsGUpadhbbpf6Q+fa6QL zsAeqb+w8xFYNd5kuFsiVOrfcmk1+pSnRaywN3xiJSC9ZZrRwQUdDapmMYpzw0Plt+nz AknHdcf0jJB0fWiiA0Z7kXV9NLJTdeN0TPUAk3et/bBi0o0VTxgVlxKVf5+Z6GKrlNAx sxaE9qWXyB4mIoIyNeLWszw+f5OW+ycxU7L4V/iCiriJRpJ0miew7TJv7fC4A+mctPpZ Lj1/+Q/Edshp9p2Luc20BGbaqroTFoT6OdNwP42COoKWxUzhIlh81jhTSSUq3z2oRKfJ wBTw== X-Gm-Message-State: AOAM532/bU/32Gf+r68acmDhRtPxRCJjGaygmS6B/v9tI8lbEQiESUWK by3ho3R6UMHWD1GmMUSayO1PX79IdZli0e3I X-Google-Smtp-Source: ABdhPJyWVonhNS6fr3gVaO5EKo+e+x5Gy8ffAX0mnYhXFUnnD4P3gPyqk2bT8DbuEnIcvfaC9seNRw== X-Received: by 2002:aca:1101:: with SMTP id 1mr1881030oir.9.1625320266903; Sat, 03 Jul 2021 06:51:06 -0700 (PDT) Received: from Ralphs-ZiffBook-Pro.local (ip72-204-153-233.no.no.cox.net. [72.204.153.233]) by smtp.gmail.com with ESMTPSA id l44sm1290314ota.47.2021.07.03.06.51.06 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 03 Jul 2021 06:51:06 -0700 (PDT) To: PHP internals References: <802fdb7d-69e5-edfa-de94-70416f9093d0@ralphschindler.com> Message-ID: <7f09e13c-7f35-b771-de4c-94c5a35df497@ralphschindler.com> Date: Sat, 3 Jul 2021 08:51:05 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [VOTE] First-class callable syntax From: ralph@ralphschindler.com (Ralph Schindler) > It would theoretically be: > > $fn = MyController::myAction(...); > > It currently errors: > >> Fatal error: Uncaught Error: Non-static method MyController::myAction() cannot be called statically > > I would be okay with allowing this, as long as it's bound before it's called. One other question regarding the current patch. I have not seen this aspect discussed yet. From the list in the first proposal section (https://wiki.php.net/rfc/first_class_callable_syntax#proposal), I am focusing this question on the few that are by name (strings).. so: strlen(...); Foo::method(...); $classStr::$methodStr(...); self::{$complex . $expression}(...); 'strlen'(...); [Foo::class, 'method'](...); Do these have to scan the target function and its signature in order to wrap them? In the cases of classes above, this will trigger the autoloader. I wonder if it could create a by-name reference that resolves the signature at just in time / at call time in these situations? In context, suppose I am suggesting that something like: $routes = [ '/my-action' => MyController::myAction(...), '/other-action => [OtherController::class, 'otherAction'](...), ... ]; would not invoke the autoloader until one of them may be actually used/called. This would be similar in philosophy as to how Foo::class creates a fully qualified string without confirming a class exists at that name when the scanner and executor sees ::class. -ralph