Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110115 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 53254 invoked from network); 10 May 2020 21:14:39 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 May 2020 21:14:39 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 484591804CB for ; Sun, 10 May 2020 12:50:54 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 10 May 2020 12:50:53 -0700 (PDT) Received: by mail-oi1-f169.google.com with SMTP id o24so13367429oic.0 for ; Sun, 10 May 2020 12:50:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ralphschindler-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=jvyCsrBDuBGpdt2nAWbj+0A7VtyF8rvffmEr4Oe6vW4=; b=ip78xKLEFJli6gX6PNYSu49btTWn9eD31roz3VcqWJclIRCs62sWc1x/O055+h4mzq ov9kEPAtPj/k2ZrIntZ3SXWOP6BcxQJ43AUqC41gXYAeGZUlhVzrOzy+zTYPGjiT9DeL 2NyQO2PIuCoF0kk94UAK3tCpWOGSWgaNpJKWASfGyQGunTerOsWsJSDSN2d4u+7XTgkO Ce5wJgKyKM9nRVV8Tc7ZO4z8+x0eBkeNw0L8JegcY8Q/7bqR05FheJfZlUHxjsJeV9x2 jD1cqw1DmSFJfBfzy05wgwwatkKbMVLwitR6itjxEeqR2dQaUhhCAyaYfjkwfx65360f k8og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=jvyCsrBDuBGpdt2nAWbj+0A7VtyF8rvffmEr4Oe6vW4=; b=go5AK3+4yzoFYiylZ+RpLEsY8l/NG/hVo79XFV9e8nje6ru/UmtVSzFPfpLQo65xD2 LAJTALTYiUvnvSIE/qZA4ajbkiPK/+Hbc08gsxO/zQZgXRlbPrZhfIrgIZ/WP/ds+Tni qxC8AdAZE3+CSkH5Tg0VURjJ1bbV55yHCInbJAZwx6PzeN/Xf/9EKsXE7L1rkLXi02F8 qiOFKTJd+rw3EEY12h82TFc99nuaJTjYVu9WtT1dbWMzt8z8vyzuNQKdLmJXKHpzCim1 UlEndrQNH253svqhWprhvKTXtzHqPjD8jj1QA9JED19HHYRTDFSxHa+5nBXMvm6A8qG0 YnZA== X-Gm-Message-State: AGi0PuaUmwk86TaDfwuRT0rQoV10YhRNrdvwJMOPLXzm4zSlMJH1WjqJ 5EH7WKLAntSxSK0xCXEBkoINtkKNTa8= X-Google-Smtp-Source: APiQypIMrurDNzorQubZRV2Ace83TK8dZe7mYZj8krHUQ0KmsJ0PoApuo1NQR/HdEmrPv3RBvqlnkw== X-Received: by 2002:aca:ec51:: with SMTP id k78mr17922197oih.60.1589140252759; Sun, 10 May 2020 12:50:52 -0700 (PDT) Received: from Ralphs-ZiffBook-Pro.local (ip72-204-153-233.no.no.cox.net. [72.204.153.233]) by smtp.gmail.com with ESMTPSA id t5sm2296946oor.36.2020.05.10.12.50.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 10 May 2020 12:50:52 -0700 (PDT) To: Nikita Popov Cc: PHP internals References: Message-ID: <46f3153a-5c35-398e-3a87-437d84afa884@ralphschindler.com> Date: Sun, 10 May 2020 14:50:51 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Proposal For Return-If / Early Return / Guard Clause Syntax From: ralph@ralphschindler.com (Ralph Schindler) > This proposal looks way too specific to me. I'm a big fan of returning > early -- but also of throwing early, breaking early and continuing > early. Supporting this just for returns seems odd / inconsistent to me. I agree with this sentiment, and I'll update the PR accordingly and this will be reflected when I make the RFC itself. (Throw feels different as its parameter is not optional and is always a complex type, and is in a different area of the parser... But I'll look more deeply at adding that soon.) > That said, I don't think this syntax solves a real problem in the first > place. If it solves a problem, it's mostly a problem of PHP coding > styles being a bit overzealous when it comes to formatting requirements > for early return/break/continue/throw. And that's not a problem that > needs solving at the language level... I think we could say the same thing about most new additions: fn arrow functions, str_starts_with/str_ends_with, trailing comma in lists & function calls, str_contains(), flexible (indented) heredocs, list reference assignment, native de-structuring.. just to name a few that all fit into the same kind of quality of life category. Nearly all of those were achievable via some kind of syntax before their addition, but I think we can agree we're better off having them, than not- even if one chooses not to use them. Having been programming with PHP for 22+ years now, and making it a point to evolve my tastes/preferences with the changing language and whatever the prevalent practices are in the community (and other languages), my desire for including these quality of life improvements remains quite high as it keeps the language interesting and competitive. Put another way, as someone who's come to really appreciate the aesthetics and clarity of intent of code,.. and having seen this is some places in the wild already I feel are successful, I personally feel its a good thing to perhaps to run through the RFC process for inclusion in 8. Thanks! Ralph Schindler