So, #PHP has fluent interfaces, but it also can do fluent functions: functions that can be chain called.
As usual, it works but it is a tad cumbersome.
[#]phptip #phptrick
https://php-tips.readthedocs.io/en/latest/tips/fluent_function.html
=> More informations about this toot | More toots from dseguy@phpc.social
@dseguy Do you have any thoughts on use-cases for this approach that a recursive function wouldn’t solve? Getting back the function itself doesn’t seem terribly useful, to me. Maybe if the input params are passed by reference?
=> More informations about this toot | More toots from ramsey@phpc.social
@ramsey I don't see anything practical for this: the result extraction is way too cumbersome and un-modern.
Although, the chained calls looks quite nice, and 'fluent function' sounds also terrific.
And, of course, blame @heiglandreas (for inspiration).
=> More informations about this toot | More toots from dseguy@phpc.social
@dseguy @ramsey @heiglandreas Changing f($v1, $v2, $v3)
into f($v1)($v2)($v3)
is really just currying.
=> More informations about this toot | More toots from Girgias@phpc.social
@Girgias @dseguy @ramsey @heiglandreas This is curry.
=> More informations about this toot | More toots from derickr@phpc.social
@derickr @Girgias @dseguy @ramsey @heiglandreas So is this.
=> More informations about this toot | More toots from Crell@phpc.social
text/gemini
This content has been proxied by September (ba2dc).