Re: [RFC] [Discussion] Short Closures

php.internals

Tom Worster

10 years ago
I'm 100% with Anthony Ferrara and Tony Marston on this. Another grumpy old curmudgeon (in addition to myself, I mean, not those two) describes four categories of bad stylists: 1. Under educated 2. Old school 3. Thrill seeker 4. Exhibitionist The first two are pretty clear, I think. The Thrill seeker is the programmer who gets a kick out exploring and using the trickier parts of a language and putting them together in exciting ways[3]. The exhibitionist is the programmer who's code needs to demonstrate superior cleverness or other skills[2]. Short closure[4] will clearly be a boon for 3 and 4. But 1 and 2 will suffer. Anthony explained already how the under educated will suffer. As someone belonging to the old school, I should explain how I will suffer. I like code that's boring and obvious. Economy with keystrokes and source code bytes or vertical lines is a non-goal. Aesthetics is a non-goal. I prefer code that, when I look at it again a year from now, it will be immediately obvious a) what i intended it to do, and b) what it actually does. This involves a lot of discipline, part of which is only using one way to do such-and-such. So I use only a subset of the language and have rules about what kinds of things each part applies to. To put it another way, when I read "Love beautiful code? We do too. The PHP Framework For Web Artisans" I feel a bit nauseous. Hence an old school stylist like me will not use ~> and I won't allow it in contributions. But I'll have to live with it in the wild. And that's going to be confusing and I wont't be able to debug other people's code and submit PRs. The new guard of ~> enthusiasts will correctly accuse me of being old and useless so I may as well just put myself out to pasture in a farm upstate. In other words, ~> will end my career. Thanks :P --- [3] A wonderful parody of the thrill seeker https://www.reddit.com/r/programming/comments/dst56/today_i_learned_about_p hp_variable_variables/c12np38 [2] https://github.com/twbs/bootstrap/tree/v1.4.0/js [1] https://youtu.be/_EANG8ZZbRs?t=48m1s [4] Why is it called this in PHP, btw? Only the optional `use ()` part is closed over (sorta) and in this proposal, not even that happens. "Anonymous function" seems very clear and descriptive. "Lambda" is great if you want to show off. But closure? Btw, => is not one of the good parts of ES6. About as good as classes, I'd say. On 8/31/15 3:29 PM, Bob Weinand wrote:

Rowan Collins

10 years ago
On 02/09/2015 20:44, Tom Worster wrote:
> In other words, ~> will end my career. Thanks :P
I know this line is just hyperbole, but it does rather sum up the tone of the rest of your e-mail. I'm honestly not sure how you expect anyone to respond. Scrolling further down, my eye lit on the last line of the e-mail you replied to:
> Hoping for constructive feedback, > Bob
That struck me as rather a contrast. PS I think you've muddled Stas with Anthony. Regards,
-- Rowan Collins [IMSoP]