Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120013 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 53721 invoked from network); 13 Apr 2023 06:51:25 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 Apr 2023 06:51:25 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 27F8218054A for ; Wed, 12 Apr 2023 23:51:25 -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.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 12 Apr 2023 23:51:24 -0700 (PDT) Received: by mail-wr1-f47.google.com with SMTP id v27so3910815wra.13 for ; Wed, 12 Apr 2023 23:51:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681368683; x=1683960683; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=qQpJMZ3qMuB/SdwoZR1FikWrNJG88k21+oCUzjN6MNE=; b=iaFO1yweVpdw9uzg+jbaFDRB+Z1FHQZ+BWprVff00Zndkgt27+2Cz5CSZS4gaouow6 BL99ZqmgscbXo0yUWNhamMtDiAYhGOGbEKsq6pKyzBfr5QpTfAemLyxoJQvD0emSYPWK SD9bmtEaV68sW91SPKv6tqwPrUmLK2A1BImcm0fNc0TjoGZIcGLWbMRF7frBWdEreOGQ wuWj9+UK0MpOxw6ZrbtoC1445PNRyD2qJegRqw+qnYGzsvTjXJMNsod4zNLAcwrsUDee wH8OxMxvHj5QQeZMCp0jU8cBIp6Lmo3/UmIw6W7uulJ4emfUp/89Tqm97VwIdft6UPkY OU0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681368683; x=1683960683; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:to:from:date:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=qQpJMZ3qMuB/SdwoZR1FikWrNJG88k21+oCUzjN6MNE=; b=EkDdcCzA6Hz6fm1Ju+cIotXyEEkT0mRjR+o/VatKN+Qbw7cu2pjcSrfWS8/37h5l2m /K+nAN5aU4ACCpPUj+O7TDifXkB94kXmD5HwNzMcNdETgeOTByxjRftICZMyo8IkUGIf ZsCgWVMD7KZWzO96UotGXBf1mPFCcgkPVpbMfWEZLMqrVC2k84x0lRmoSJaAJWXtr1GR TG2DbyT20FVonk7oo7WAKPZkOHyzOxnt2sIvvnFhg+iL7Z3zDNOwZXPkB0WXSfcZzT2Z 8o5c/upMfQ7c8ALPfWWg3rFNYIsi0z6GW1H+Y9XwQPMjFGDB6mZ4k1HB7bE0NNA4gv08 gwXw== X-Gm-Message-State: AAQBX9frNIpv+7xGVCrrH5WmLV0f3tC+EiJN4kH0ExpdkK8V2Yo33RIf g+I+O1kwmtNKjHZa5rXP4rD7iQxtiO8= X-Google-Smtp-Source: AKy350ackKeItc2OJxIE9IFOpVTrZlJyoFNMwn38EaPoiKDOkAAKPePbewQGTOOgJzgA+FNY5v1JBw== X-Received: by 2002:a5d:6341:0:b0:2f0:7ee:5c23 with SMTP id b1-20020a5d6341000000b002f007ee5c23mr3074962wrw.35.1681368683501; Wed, 12 Apr 2023 23:51:23 -0700 (PDT) Received: from [127.0.0.1] (cpc83311-brig21-2-0-cust191.3-3.cable.virginm.net. [86.20.40.192]) by smtp.gmail.com with ESMTPSA id w15-20020a5d608f000000b002f1dc56579esm598147wrt.2.2023.04.12.23.51.22 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Apr 2023 23:51:22 -0700 (PDT) Date: Thu, 13 Apr 2023 07:51:21 +0100 To: PHP Internals User-Agent: K-9 Mail for Android In-Reply-To: References: Message-ID: <246CC9DA-2AC1-46E6-8362-69A6F7DE16D9@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] First class callable syntax for instance methods From: rowan.collins@gmail.com (Rowan Tommins) On 13 April 2023 04:59:56 BST, Eugene Sidelnyk wrot= e: >It would be a great pleasure to have the ability to wrap the instance >method the same way=2E=20 The first-class callable syntax works just fine with instance methods, but= you need to use it on a particular instance: $someInstance->someMethod(=2E= =2E=2E) Unfortunately, this is no use for your example, essentially because PHP (u= nlike, say, Python) doesn't consider $this to be part of the parameters to = a method: Verification::getId(=2E=2E=2E) would mean fn($item) =3D> Verifica= tion::getId($item) but you can't call an instance method that way=2E What you want is fn($item) =3D> $item->getId()=2E A syntax like =2E=2E=2E-= >getId() wouldn't be much use - it wouldn't be able to check for the method= 's existence in advance (the "call to non-static" error in your example hap= pens as soon as you try to create the closure https://3v4l=2Eorg/G8va8), or= copy over any type information, because there's no way to deduce what clas= s will be used later=2E So maybe it would need some other indicator, like Verification::getId(inst= ance =2E=2E=2E) to indicate that you want a closure with an extra parameter= to be used as the instance=2E Maybe someone has a less ugly suggestion? Regards, --=20 Rowan Tommins [IMSoP]