Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108546 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 66923 invoked from network); 13 Feb 2020 19:12:18 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 Feb 2020 19:12:18 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 66FB71804D1 for ; Thu, 13 Feb 2020 09:26:43 -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.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) (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:26:42 -0800 (PST) Received: by mail-io1-f45.google.com with SMTP id m25so7348588ioo.8 for ; Thu, 13 Feb 2020 09:26:42 -0800 (PST) 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=/7YaGwO5tRW7d+makuxfzws+EU566T+JpyE1cNgV07U=; b=Mcurdy3XKfYR9Ffk7h3eTy4BKB7RhWfutrbA0vEbPmCMofKURSGlpMRehF5EyzSv1f 8CaptsggyTHCV+ccapWnXwvKixW+EqY1Lyki24NbyVnb8h6xiQZ0YssfN+XxXBEVaBQ+ R2WK87ZqfMme9agKoFeQjO+9GxJU8XMV0twSriy5X9CVw4XI7xjDlPC7fybNdnSxQcNC dpRcCUhqzZuucwnU4iSwAxMb26NyP9NsV5ZUxeHdI3G4OW+QQeN4VKmr3SSJe5Y2cfDE 7NmXaVDMg9ra0/rwzdMAewgwpLi4jVSWFACEsMBAvfVNCotTk5K7DtREysD7By/e08rO c2Hw== 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=/7YaGwO5tRW7d+makuxfzws+EU566T+JpyE1cNgV07U=; b=hR5BinFigGhrQKhjo1WzdepfiAjL5TeIIegZKIRrJYDIJR1K+uwpDHEk3BF86zOCu7 XQUhEu5SQFYn0jSxAVDWRskBZ+ng04vZKH0SwaRXGG4rtjtQfOr7g/jBc92WPq1nsUyR QwGlFFBxYCwDzxDRD18tV23WDyQZ4w/B0dAV7NfKWYS+p/PB4sTlCwSxqKI3iIS5Eq4Q G6iL29roN7kc2BFSHeGMHDZkLuBolJ/EovRs7qYHsbdp1R03I/C76tme8jv9QTRgU42n 2W3A4mOMMKtDCv3aRURJJkoUiTEtnn6UJ416xod6167DMMiaJ2ZylNtJXuH3+d8VT+rC YMpQ== X-Gm-Message-State: APjAAAWIj+vz87j52IKh6+xPeDwhKxAjtj8+HXyWv29aPjDJeAsGcedl WzdtHgkJy3G+RjoGVBw/nMyyk9z7ZNnuf2mY35HhUaB1 X-Google-Smtp-Source: APXvYqyYk17RmSbesf0orhR2X4gWIvb7ySL8INHV06bzpNZFYeFVWceVkWpEXbkcCUhIB0HzkrSia8cGkn4MF7eZE+0= X-Received: by 2002:a6b:4906:: with SMTP id u6mr22025408iob.120.1581614799508; Thu, 13 Feb 2020 09:26:39 -0800 (PST) MIME-Version: 1.0 References: <10FCCCED-B8AE-4394-91B3-0FEB448E2398@gmail.com> In-Reply-To: Date: Thu, 13 Feb 2020 17:26:28 +0000 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="0000000000004bd68a059e786439" Subject: Re: [PHP-DEV] [RFC] From: rowan.collins@gmail.com (Rowan Tommins) --0000000000004bd68a059e786439 Content-Type: text/plain; charset="UTF-8" On Thu, 13 Feb 2020 at 17:06, Mike Schinkel wrote: > 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? > Right, I'm with you now. However, I think the answer people are suggesting to "how do we get the name string?" is "why do we need to?" Or as Chase Peeler more eloquently put it: > Can anyone think of a use-case where you would want a string name of a > function and a callable would not be acceptable, besides possibly debugging > code that said 'echo "I'm calling ".myfunction::function;'? Everything that > I can think of that accepts a function name, also accepts a callable (e.g. > array_map), but I could be forgetting something. There's a Venn diagram, essentially, of: a) use cases where a Closure would be useful, but a string wouldn't b) use cases where a string would be useful, but a Closure wouldn't c) use cases where either a string or a Closure would be useful If (and it's a genuine open question) all the use cases fall into categories (a) and (c), we can make the syntax for closures simpler by skipping the "get name" step and making foo::fn return a closure straight away. So the question is, are there use cases that fall into category (b)? Regards, -- Rowan Tommins [IMSoP] --0000000000004bd68a059e786439--