Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108611 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 22741 invoked from network); 16 Feb 2020 01:10:56 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Feb 2020 01:10:56 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2AF3B180504 for ; Sat, 15 Feb 2020 15:25:58 -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=-2.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,SUBJ_ALL_CAPS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS24940 116.202.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from outbound.soverin.net (outbound.soverin.net [116.202.65.215]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 15 Feb 2020 15:25:57 -0800 (PST) Received: from smtp.freedom.nl (unknown [10.10.3.36]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by outbound.soverin.net (Postfix) with ESMTPS id 2F6E0601EC; Sat, 15 Feb 2020 23:25:56 +0000 (UTC) Received: from smtp.freedom.nl (smtp.freedom.nl [116.202.65.211]) by soverin.net DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=freedom.nl; s=default; t=1581809155; bh=PvwvJmcHh9TDr1vAwNwA51FFi1sUbEhbxrneLZ5Izq8=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=PeElX5sz5kU4TKKZuikLLocDunsjZI8Gau1Os8LWsD7F31bUjVduTxDB2iv6LCyUo EwaDBKJH6gZQLOo1W7GFL0CF11R72r1bFoPAV50fEHkWAHn3k/JN0hZA2tw+DEi6+o kkWyGlfXoze3xgaAxQLtQQKI4E/ydah6b5PHj1f8= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=freedom.nl; s=default; t=1581809156; bh=PvwvJmcHh9TDr1vAwNwA51FFi1sUbEhbxrneLZ5Izq8=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=x9OeyU6G8vVsbsCdxZshz4uE2Br5IeTh5+vy3skE765brQQlU6Tmlugocwsfqkkx6 yPEa2s1nt0uWhYn5v2pzEXU7JcJ9lCJC6RsYJiYu/Q/dDae9L64MXclkJMYoxM3xxs yE+BnELCIfEK1tTfgHebAl44Y0Tz0IjLNmFoNQwg= To: Manuel Canga Cc: php internals References: <10FCCCED-B8AE-4394-91B3-0FEB448E2398@gmail.com> <2C404984-AD76-4CDF-8E1A-04DF8EF024DD@newclarity.net> <0BE8FC1E-A9BF-4A2A-9CA5-59BEE1245632@gmail.com> <938FDD44-1F60-4FE1-B0F1-E70284F5F2D2@newclarity.net> <4760949c-abcd-47ab-9553-4e65db80fbd8@www.fastmail.com> <17048bed3be.d504db79162980.4703631943717571842@manuelcanga.dev> Autocrypt: addr=d.h.j.takken@freedom.nl; keydata= xjMEXimHTRYJKwYBBAHaRw8BAQdAzvRUI24yOGvteVk9N6VKIt425fNgg0P1rvD2WQLGP+fN JERpayBUYWtrZW4gPGQuaC5qLnRha2tlbkBmcmVlZG9tLm5sPsKtBBMWCAA+FiEEvtrj9qG2 TA2YmjvLhef0X6cSlpAFAl4ph00CGwMFCQlmAYAFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AA IQkQhef0X6cSlpAWIQS+2uP2obZMDZiaO8uF5/RfpxKWkPywAQChh9Z1jSvitkT3sIipwMlk dnUlYY5Ue3lHBBhF6pQUOwD/XtEz/fsjvqE/GpjJhXpxNodwKjLhaUiFe9qRwwH/5QXOOARe KYdNEgorBgEEAZdVAQUBAQdAMNSCUI0PnOjjrFKZDAFRQzKLVDCINuFNgsXh0snmlUwDAQgH wpUEGBYIACYWIQS+2uP2obZMDZiaO8uF5/RfpxKWkAUCXimHTQIbDAUJCWYBgAAhCRCF5/Rf pxKWkBYhBL7a4/ahtkwNmJo7y4Xn9F+nEpaQEYUA/2mZ3uEN0JTRUZbxHGBMB4IhQw0cdIML FpFrTycqUCXCAQD5rWXomBWVD/DRHk7O3KjNsek9F1DEZgGeZ5pPmNF/Dg== Message-ID: <1d114b72-56e0-b3c3-8099-876e708c2083@freedom.nl> Date: Sun, 16 Feb 2020 00:25:53 +0100 MIME-Version: 1.0 In-Reply-To: <17048bed3be.d504db79162980.4703631943717571842@manuelcanga.dev> Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-Virus-Scanned: clamav-milter 0.102.1 at c03mi01 X-Virus-Status: Clean Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] From: d.h.j.takken@freedom.nl (Dik Takken) On 15-02-2020 13:07, Manuel Canga wrote: > Do you think it is worth creating an RFC page about :: function ? I say that because I see that there are many voices against of :: function Let us go back to the start of this thread. Your idea was to simplify array_map('\My\I18N\i18n_translate', $array) to array_map(i18n_translate::func, $array) Then the discussion took the topic one level deeper. In your examples, you seek a better way to pass a function as callable. In PHP a callable can be: 1. a string 2. an array 3. a closure Then it was suggested that a short syntax to wrap the function into a closure is more useful. Using strings to refer to functions has consistency issues and the proposed ::func does not solve them. Also, the array syntax for referring to methods could use a better alternative. All things considered, I think the originally proposed feature, using ::func to get the function name, has limited use. Having a ::func (or ::function or ::fn) return a closure might be somewhat controversial and there is no consensus about the name. The only way to know how this will be received is to write an RFC and call for a vote. My own guess would be that an 'enclosure' construct along the lines of array_map({i18n_translate}, $array) array_map({$object->method}, $array) has better chances of succeeding but you never know what happens. Perhaps you could team up with MichaƂ and use the feedback from this thread to produce an RFC. Regards, Dik Takken