Re: [RFC]

From: Date: Tue, 11 Feb 2020 12:42:52 +0000
Subject: Re: [RFC]
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-108472@lists.php.net to get a copy of this message
On Tue, 11 Feb 2020 at 13:16, Nicolas Grekas <nicolas.grekas+php@gmail.com> wrote: > > > > Le mar. 11 févr. 2020 à 12:52, Diogo Galvao <diogo86@gmail.com> a écrit : >> >> On Tue, Feb 11, 2020 at 8:14 AM Manuel Canga <manuelcanga@gmail.com> wrote: >> > >> > Hi internals, >> > I Would like to present a possible new "::func resolution" for your >> > consideration. >> ... >> > use function \My\I18N\i18n_translate; >> > >> > $mapped_array = array_map(i18n_translate::func, $array); >> ... >> > What is your opinion ? Do you see it useful ? >> >> I've wished for this on many occasions and think it'd be really useful, as long >> as it could work with methods as well: >> >> $mapped_array = array_map(I18N::translate::function, $array); >> >> For what it's worth I guess it could just return [I18N::class, 'translate']. > > > I wish this would return a Closure instead, making $foo::function the equivalent of > Closure::fromCallable($foo). Hi, Nicolas, Currently, when <class_name>::class is used, class with <class_name> can or cannot exists in that moment. Using <function_name>::func( or <function_name>::function ), I think should keep the same behavior. Using ::func as alias of "Closure::fromCallable" check if function exists in that moment. It is certainly useful, but, I think it's more important be consistent Thanks, Nicolas,

« previous php.internals (#108472) next »