Re: [PHP-DEV] [RFC]

This is only part of a thread. view whole thread
  108466
February 11, 2020 12:08 manuelcanga@gmail.com (Manuel Canga)
Hi, Diogo

That's right. I could be useful with classes as well.

I was thinking about 'function' or 'func'. 'function' is more
semantic, but 'func' is used with "short functions"( PHP 7.4 ) and
these will be used for callbacks. Then I think 'func' will be more
consistent.

Thanks, Diogo,

On Tue, 11 Feb 2020 at 12:51, Diogo Galvao <diogo86@gmail.com> wrote:
> > 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']. > > Also for keeping consistency and avoiding new keywords wouldn't it fit better as > ::function instead of ::func? > > > Best regards. > Diogo
  108473
February 11, 2020 12:47 guilliam.xavier@gmail.com (Guilliam Xavier)
Hi,

On Tue, Feb 11, 2020 at 1:09 PM Manuel Canga <manuelcanga@gmail.com> wrote:
> > I was thinking about 'function' or 'func'. 'function' is more > semantic, but 'func' is used with "short functions"( PHP 7.4 ) and > these will be used for callbacks. Then I think 'func' will be more > consistent.
Actually PHP 7.4's short closures / array functions use `fn`, not `func`. But `::fn` would look... weird. I agree with Diogo that `::function` would be more consistent. -- Guilliam Xavier
  108474
February 11, 2020 12:57 manuelcanga@gmail.com (Manuel Canga)
Ups!. What big mistake!

Then ::function should be a better option.

Thanks, Guilliam,

On Tue, 11 Feb 2020 at 13:47, Guilliam Xavier xavier@gmail.com> wrote:
> > Hi, > > On Tue, Feb 11, 2020 at 1:09 PM Manuel Canga <manuelcanga@gmail.com> wrote: > > > > I was thinking about 'function' or 'func'. 'function' is more > > semantic, but 'func' is used with "short functions"( PHP 7.4 ) and > > these will be used for callbacks. Then I think 'func' will be more > > consistent. > > Actually PHP 7.4's short closures / array functions use `fn`, not `func`. > But `::fn` would look... weird. > I agree with Diogo that `::function` would be more consistent. > > -- > Guilliam Xavier