Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88013 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6650 invoked from network); 2 Sep 2015 19:44:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Sep 2015 19:44:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=fsb@thefsb.org; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=fsb@thefsb.org; sender-id=pass Received-SPF: pass (pb1.pair.com: domain thefsb.org designates 173.203.187.123 as permitted sender) X-PHP-List-Original-Sender: fsb@thefsb.org X-Host-Fingerprint: 173.203.187.123 smtp123.iad3a.emailsrvr.com Linux 2.6 Received: from [173.203.187.123] ([173.203.187.123:51768] helo=smtp123.iad3a.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F7/21-28189-7A157E55 for ; Wed, 02 Sep 2015 15:44:40 -0400 Received: from smtp16.relay.iad3a.emailsrvr.com (localhost.localdomain [127.0.0.1]) by smtp16.relay.iad3a.emailsrvr.com (SMTP Server) with ESMTP id 1AF491803E4 for ; Wed, 2 Sep 2015 15:44:37 -0400 (EDT) Received: by smtp16.relay.iad3a.emailsrvr.com (Authenticated sender: fsb-AT-thefsb.org) with ESMTPSA id 8FEE41801D1 for ; Wed, 2 Sep 2015 15:44:35 -0400 (EDT) X-Sender-Id: fsb@thefsb.org Received: from [10.0.1.2] (c-73-4-147-142.hsd1.ma.comcast.net [73.4.147.142]) (using TLSv1 with cipher DES-CBC3-SHA) by 0.0.0.0:465 (trex/5.4.2); Wed, 02 Sep 2015 19:44:37 GMT User-Agent: Microsoft-MacOutlook/14.5.4.150722 Date: Wed, 02 Sep 2015 15:44:31 -0400 To: PHP Internals Message-ID: Thread-Topic: [RFC] [Discussion] Short Closures Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: 7bit Subject: Re: [RFC] [Discussion] Short Closures From: fsb@thefsb.org (Tom Worster) 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: > I had this RFC in draft since some time, but delayed it due to all the >ongoing PHP 7 discussions. Also we have no master branch to merge >features in until 5.4 EOL. Thus I'm reviving this now. > > Time for the first RFC targeting PHP 7.1 (assuming PHP 8 isn't going to >be the next version ;-)): > > The short Closures RFC: > https://wiki.php.net/rfc/short_closures > > Hoping for constructive feedback, > Bob >