On Tue, Feb 6, 2018 at 8:24 AM, Larry Garfield <la...@garfieldtech.com>
wrote:
>
>
> That said, I'm not sure that function autoloading will be that big of a
> carrot
> for the major projects at this point.  Wordpress is going to ignore
> anything
> we do here anyway for at least 15 years, and pretty much every other
> project
> in existence has gone all-OOP or nearly-all-OOP at this point (good or bad
> is
> beside the point).  Namespaced user defined functions are rare in my
> experience
> outside of very specific libraries (such as functional tooling libs).  So
> "yay,
> you can now autoload namespaced user-defined functions" will likely be met
> with
> a lot of "what are those?"
>
>
I disagree with this assessment. Many functions are actually collected in
static classes so they can be autoloaded. So instead of,

namespace Foo\Bar;

class Map {
    public static function modelToApi(Model $model) : array {}
}

The function can now just be in a namespace directly, instead of treating a
class like a namespace. You can then also import just the function you
need, instead of the whole class. Many of these classes exist in projects
I've worked on just for the purpose of being able to autoload the functions
when needed. My 2 cents.


> --Larry Garfield

Reply via email to