Re: [RFC] Short functions, take 2
| From: | Mike Schinkel | Date: | Thu, 25 Mar 2021 02:02:05 +0000 |
| Subject: | Re: [RFC] Short functions, take 2 | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-113752@lists.php.net to get a copy of this message | ||
> On Mar 24, 2021, at 8:39 PM, Larry Garfield <larry@garfieldtech.com> wrote:
>
> As requested, splitting off the short-functions RFC to its own thread.
>
> https://wiki.php.net/rfc/short-functions
>
> In response to the feedback that the savings in typing volume is small, that's true but
> also not the main point. The main point is to allow and encourage functions to be written an in
> "expression style", that is, as actual functions and not procedures. As the RFC notes,
> such use cases are increasing, and is likely to increase in PHP, and that's overall a good
> thing for the language. It fits well with a number of recent RFCs both passed and proposed, and
> makes writing functional-style code much more natural.
I like it.
I hope this passes, and would vote for it if I had a vote.
-Mike
P.S. I do find myself lamenting that while this FRC makes code more concise it does not do anything
to reduce the (IMO overly) verbose nature of method declarations that require both a visibility
modifier and the function keyword. And while I know you just stated that conciseness in not a main
goal, it is still a benefit of this proposal.
It would be much nicer if we could indicate in fewer characters what the visibility modifier and the
function keyword currently denote. Yes, that could be addressed in another RFC, but it could also be
addressed in this one — assuming there was a will do to so — so now felt like a good a time as
any to bring it up.
Assuming others besides just me would like to see function signatures be made less verbose and would
like to see some proposed alternatives, please ask and I will happily follow up with some ideas.
>
> PSR-12 may be unnecessarily verbose (I dislike PSR-12 myself, and have made no secret of that),
> but it is far and away the most widely used coding standard in PHP land so we cannot ignore its
> influence.
>
> --
> Larry Garfield
> larry@garfieldtech.com
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: https://www.php.net/unsub.php
>