[RFC] - Externals
DRANK

I would love a nicer way to reference function names; it's really uglyto do functional code in PHP otherwise, or even just dynamic functionlogic within a namespace. If I never have to write $fn = NAMESPACE. '\a_func' again, it will be too soon. :-)Perhaps Larry can convince us all to go for something like $() byposting a fabulous functional programming example?I walked right into that one, didn't I...Well, Dik asked me to post a "fabulous functional programming example". I dont' have one, so I'll go with one from the book I'm working on instead. :-)This is what I have now, assuming all global functions:$result = Stats::of($string)->analyze('normalizeNewlines')->analyze('readingLevel')->analyze('countStats')->analyze(fn($s) => wordDistribution($s, 3));I think we are all in agreement that is sub-optimal. If using functions in the Stats\Analyzer namespace, you end up with this:$result = Stats::of($string)->analyze('\Stats\Analyzer\normalizeNewlines')->analyze('\Stats\Analyzer\readingLeve…

externals.io
Related Topics: