Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98692 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83476 invoked from network); 30 Mar 2017 18:25:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Mar 2017 18:25:55 -0000 Authentication-Results: pb1.pair.com header.from=derokorian@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=derokorian@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.54 as permitted sender) X-PHP-List-Original-Sender: derokorian@gmail.com X-Host-Fingerprint: 209.85.218.54 mail-oi0-f54.google.com Received: from [209.85.218.54] ([209.85.218.54:32803] helo=mail-oi0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A7/B0-13909-2BD4DD85 for ; Thu, 30 Mar 2017 13:25:55 -0500 Received: by mail-oi0-f54.google.com with SMTP id b187so39495511oif.0 for ; Thu, 30 Mar 2017 11:25:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=WaN0jVhWlOdmCf2haSYINaTOI/QrBrgit9XpzVC/a50=; b=onVlNqvxMpX3hST0skPCHaW4LtW1Z80+hAO/zzcIZ56Z5ZeJB4BgJCPuFTpNH5zVv7 tZ+SciNuVrzmIlV8FEmg6LvglQHHozVO1bFBVe5dakNcv+u8blM4BPEWeHjraeKCn8se 6NTV+8up9bUdIMfqYd7fAN6BVp92aPC8wfzHfTPkV8doyIR2y4U6LS71RfTXMDtk5rp1 pWgqqjYmZXUBwspxqipX7oIG2seR+OlQju4Ll/hBQl8tAS++LTUmjg3w92XMAWXsFvQ1 xF7hPFc1K+HknnTruBFzryrYWPqTSUH6HfF1c+YqJKvuvaQz8Byb+6yPHz6JXsVPlIfl 1yuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=WaN0jVhWlOdmCf2haSYINaTOI/QrBrgit9XpzVC/a50=; b=dTfSvBXXjeASKlogKJsE+75Reb4/r4uyAbK2gQ/M7u0BtIYYmQKodnOhc3z3DItg7z OhG6v9hUPlm2CVMmAZoicbSOSqIVcl4IN66akiISZovA7ldHmHYfypH7R78ViMp8im4k mCHZPHCV/y5uX6D/6tMZU+F48Dt2zvj1gA3wNArk4zlklOsgazFGDtbm3wvIB8NbELHe A08EkCrMbvYVVXn24VA1CumrRNEbEBqT1URMtfZzoQoplsr0+4j3yDhm40b9vfwrxwoR xBHOII8zscO+1iu0Jl2wxh+EsDtggifj91qWqVJLl1GYWWv2r0CjPB9VvhFXjpsCfVQc sJLA== X-Gm-Message-State: AFeK/H3YPIc9w20sWrAbQVvEAYbASdB8joaxwXaNnoghOemQSWSjuIeX70d7z7i/5BKkDV3DZDji+FAxJyoyug== X-Received: by 10.157.60.157 with SMTP id z29mr773254otc.9.1490898351468; Thu, 30 Mar 2017 11:25:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.27.68 with HTTP; Thu, 30 Mar 2017 11:25:51 -0700 (PDT) In-Reply-To: <1490897949.13915.56.camel@schlueters.de> References: <1490897949.13915.56.camel@schlueters.de> Date: Thu, 30 Mar 2017 12:25:51 -0600 Message-ID: To: =?UTF-8?Q?Johannes_Schl=C3=BCter?= Cc: Davey Shafik , dmitr y , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=94eb2c18fceca2b4ba054bf6d201 Subject: Re: [PHP-DEV] ; on the end of the line From: derokorian@gmail.com (Ryan Pallas) --94eb2c18fceca2b4ba054bf6d201 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, Mar 30, 2017 at 12:19 PM, Johannes Schl=C3=BCter wrote: > 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 =3D [1, 2, 3] > [rand(0, 2)] > var_dump($a) > ?> > > $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. > I would also point out, that I haven't worked on a JavaScript project in ages where the conventions / rules of that project allow leaving off semi-colons. While the language may make it acceptable, most organizations have rules requiring semi-colons. The reason is to avoid the disambiguation as Johannes has pointed out. > > johannes > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --94eb2c18fceca2b4ba054bf6d201--