Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108544 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 61400 invoked from network); 13 Feb 2020 18:52:03 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 Feb 2020 18:52:03 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 309391804AB for ; Thu, 13 Feb 2020 09:06:29 -0800 (PST) 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.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,SUBJ_ALL_CAPS 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-yw1-f41.google.com (mail-yw1-f41.google.com [209.85.161.41]) (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 ; Thu, 13 Feb 2020 09:06:28 -0800 (PST) Received: by mail-yw1-f41.google.com with SMTP id i126so2912762ywe.7 for ; Thu, 13 Feb 2020 09:06:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=xc5NmIpiZctjg0XC4lNHCnNgfZQ6L4z4uYpkyoEE2aA=; b=yhfYaZ2dCduBoBmno59eBcw3FcTx6syotiTo4LPHWTl3bjKAjJ9Q/5c8UlRkRoNke2 0sbnsMXDniFkakOAtbULJiRpFie7z7jeuVVfNaUFEw5xWpwCwf+XQp4qivUrUkDI38x3 xU4gIzkcM+bBKWumDZFvEmTGCnwIYXc/zvtVjQHLn97uQTw2zQ4oykkRC9LoIN7mbCWk PIWoSBvR8UM/gYkMoq4RKJGULiU3d67oESHFWGc8Af2vqVo5uFXS7nWXTqxMuJYopgfC kDMw4u7LjpTB7jlboBphtNupgYDaP2XjUcir49SWiNcS0xo1YTxSJYhyrRWEqboDf8AA PdXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=xc5NmIpiZctjg0XC4lNHCnNgfZQ6L4z4uYpkyoEE2aA=; b=gGuCtL/k4EMdyH3gQhcUMYUu07LpwpRE1E0lbp/xSVtKKNE4GpWXkoaeUOvbGbxuMU j1A10u7R1/RJw4GW/vVPojKJ2/YzDpYry3s2BKO/NXOYzOkdaSiToM5EEzxPlDb5m+Sh QDR36tc8qBJtQTTOQmWRTm9djXUAPzS1bkKFigdf3CtEO7rF13cXmGt8mvuhsAHJAIbq Yy+ztZTAr12qsDnSWJXhRTpVYSwNzKHZJ8b8f/95YXzb9j4scufiVY5Hfg+KNbe5tp7x 1f3ar8hhG0+wlCjKE1yi0lUHsNEyTbUUCSsAZj0rJq7X7Xr63IInjLr5r/KNwikigntN IC+A== X-Gm-Message-State: APjAAAXtLGjxHtf5Y1r5MJdazszocDGJb6Cs/Z/IKuK96MIjsmlpd8bk QE68Cf1nCTAT6jQ25hkBWuBOZUji3tgotQ== X-Google-Smtp-Source: APXvYqwEzj4eA6VpAKqaytI18pMdMHsNziST1IG4UgKMe6FQYUOGoA2+qaptCH/BM9938LQ30dR2uQ== X-Received: by 2002:a81:9a82:: with SMTP id r124mr13586794ywg.469.1581613587066; Thu, 13 Feb 2020 09:06:27 -0800 (PST) Received: from ?IPv6:2601:c0:c680:5cc0:c40d:6267:8a93:b5b9? ([2601:c0:c680:5cc0:c40d:6267:8a93:b5b9]) by smtp.gmail.com with ESMTPSA id j72sm1409182ywj.60.2020.02.13.09.06.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Feb 2020 09:06:26 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) In-Reply-To: <10FCCCED-B8AE-4394-91B3-0FEB448E2398@gmail.com> Date: Thu, 13 Feb 2020 12:06:25 -0500 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: References: <10FCCCED-B8AE-4394-91B3-0FEB448E2398@gmail.com> To: Rowan Tommins X-Mailer: Apple Mail (2.3445.104.11) Subject: Re: [PHP-DEV] [RFC] From: mike@newclarity.net (Mike Schinkel) > On Feb 13, 2020, at 2:33 AM, Rowan Tommins = wrote: >=20 > On 13 February 2020 03:33:32 GMT+00:00, Mike Schinkel = wrote: >>> On Feb 12, 2020, at 5:47 PM, Rowan Tommins >> wrote: >>>=20 >>> On 12/02/2020 03:58, Mike Schinkel wrote: >>>> Returning a_closure_ instead of a string would be providing a >> feature we_already_ have instead of one we do_not_ have. >>>=20 >>>=20 >>> Not really, because you still need a way to get the fully-qualified >> name of the function. This is not valid: >>>=20 >>> namespace MyVendor\Something\Foo; >>> function bar() {} >>>=20 >>> \Closure::fromCallable('bar'); # Error: tries to resolve function >> '\bar' >>>=20 >>=20 >> Why would ::function return a short name instead of the = fully-qualified >> name?=20 >=20 >=20 > I never said it would; the intent of this example was to show what is = possible in current PHP, in response to your comment about returning a = closure being "a feature we already have". > The key new feature being proposed is a way to resolve an unqualified = function name based on current namespace and imports, without calling = the function. The open question is whether the result of that should be = expressed as a string or as a Closure object, but in current PHP the = feature doesn't exist at all. Let me clarify for you what I was trying to say. 1. IF foo::function returns a name string THEN using = Closure::fromCallable( foo::function ) can provide a closure. 2. IF foo::function returns a closure THEN how to we get the name = string? Hence we already have a way to get the closure _if_ ::function returns a = name string, but we would *not* have a way to get the name string if = ::function returns a closure. =20 IOW, we can already derive a closure if we have a name, but we cannot = derive a name if we have a closure. I hope this clarifies what I was trying to say when I said "we already = have it." -Mike=