Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98691 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81745 invoked from network); 30 Mar 2017 18:19:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Mar 2017 18:19:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 84.19.169.162 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 84.19.169.162 mail.experimentalworks.net Received: from [84.19.169.162] ([84.19.169.162:55226] helo=mail.experimentalworks.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 29/50-13909-52C4DD85 for ; Thu, 30 Mar 2017 13:19:18 -0500 Received: from kuechenschabe.fritz.box (ppp-46-244-177-32.dynamic.mnet-online.de [46.244.177.32]) by mail.experimentalworks.net (Postfix) with ESMTPSA id 5429653367; Thu, 30 Mar 2017 20:19:14 +0200 (CEST) Message-ID: <1490897949.13915.56.camel@schlueters.de> To: Davey Shafik , dmitr y Cc: "internals@lists.php.net" Date: Thu, 30 Mar 2017 20:19:09 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.5.2-0ubuntu3.1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] ; on the end of the line From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Do, 2017-03-30 at 00:07 -0700, Davey Shafik wrote: > Notice each of these has two statements. (Note: I don't think any of > these > are particularly good ways to write readable code, but they are all > syntactically valid code). The imo more relevant cases are the one where an optional semicolon causes unclear behavior. Consider we make it optional, what is the behavior of this code: $a could either be an array with three elements or a single integer value which is randomly chosen out of the array. Requiring a statement separator like semicolon makes this clear. > While I know some languages make semicolons optional (javascript), or > omit them entirely (python),  semicolons in PHP will not be going > away (or optional) any time soon. JavaScript shouldn't be our role model here - it has relatively complex rules for this (essentially "if treating a following line as belonging to the statement leaves valid code then treat it as part of the same statement else terminate the statement on the new line") Python does this by requiring indention on the continuing line. As PHP isn't whitespace-programming this isn't applicable for s either, while it's a way more consistent design than JavaScript in that regard. johannes