Re: [PHP-DEV] [RFC]

This is only part of a thread. view whole thread
  108611
February 15, 2020 23:25 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