Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92053 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92864 invoked from network); 31 Mar 2016 18:09:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Mar 2016 18:09:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=zeev@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=zeev@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 207.46.100.110 as permitted sender) X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 207.46.100.110 mail-by2on0110.outbound.protection.outlook.com Received: from [207.46.100.110] ([207.46.100.110:30392] helo=na01-by2-obe.outbound.protection.outlook.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6D/52-15473-3E76DF65 for ; Thu, 31 Mar 2016 13:09:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=RWSoftware.onmicrosoft.com; s=selector1-zend-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=KsfZjlMR+cjtfJdLBOwwxkvD3gWpvQBjMWz3lx40+SM=; b=ohwzS/TIWOLvZIAG2psrvur79hroxuGOMeJYOzsmJcpSp3YUGVwHopoefWb23zmBf7w9PDMJOipd1Uw2HDrmdbHtdLDKkgrLk3Z4EO0xayV3MjYTw/7aaijQJWswXk/8y5b/bH3Y0+WvK6jDPvDQmix/N92nw+4ZC1033QazPxQ= Received: from BY2PR02MB298.namprd02.prod.outlook.com (10.141.140.21) by BY2PR02MB300.namprd02.prod.outlook.com (10.141.140.26) with Microsoft SMTP Server (TLS) id 15.1.447.15; Thu, 31 Mar 2016 18:09:35 +0000 Received: from BY2PR02MB298.namprd02.prod.outlook.com ([10.141.140.21]) by BY2PR02MB298.namprd02.prod.outlook.com ([10.141.140.21]) with mapi id 15.01.0443.017; Thu, 31 Mar 2016 18:09:35 +0000 To: "guilhermeblanco@gmail.com" , Larry Garfield CC: PHP internals Thread-Topic: [PHP-DEV] [RFC Discussion] Typed Properties Thread-Index: AQHRf6Ic51Gg23WNHU+9c7DSzDHy759cVmwAgAAC8ICAAAQ6gIAAArwAgAAHWICAAdLfgIAF1WiAgAAYowCAAVH4AIAAHmmAgAABaICAAEfigIAAIEKAgAqejYCAAAsvgIAAAagAgAABqACAAG5ngIAAR/mAgAE8wACAAK50AIAABq+AgAA+BoCAAAKsIIAAOnUAgAAYr4CAAAYLWQ== Date: Thu, 31 Mar 2016 18:09:34 +0000 Message-ID: <56FE7A8F-B093-49AA-BC19-FCB28701855A@zend.com> References: <56F16023.1010002@gmail.com> <56FC4ED6.6050701@telia.com> <56FCE6C9.1050302@zend.com> <56FD4E18.7070703@garfieldtech.com>, In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=zend.com; x-originating-ip: [87.70.34.179] x-ms-office365-filtering-correlation-id: 75186780-78a9-430d-0eb0-08d3598f9dc0 x-microsoft-exchange-diagnostics: 1;BY2PR02MB300;5:nOsGvPjmBGNDeuP+kQs0eW+z2RTPF30kBJNbasmI2fzYI+wSFAgYz114F9wjaNKzLkdsFJaBIEsru+bQNpe9DgLDnggJUZHAQxANjHC+TbPkvsNI91r47kgoPa5Yffytm4PSHOjaI5lXBhDcfZCvrg==;24:hA6DqlSFYjWnLGq729KnI53xt+rrd8g50KNxjcArulBAteRbC0BqRSf9hP6LJ8np07mOoCPW5guHLPaGm8pFTVO78VEMLIdZJyqDTR07O2I= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR02MB300; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046);SRVR:BY2PR02MB300;BCL:0;PCL:0;RULEID:;SRVR:BY2PR02MB300; x-forefront-prvs: 0898A6E028 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(24454002)(5008740100001)(2501003)(93886004)(11100500001)(99286002)(81166005)(2906002)(10400500002)(3660700001)(122556002)(5004730100002)(3280700002)(86362001)(4326007)(66066001)(77096005)(2900100001)(87936001)(19580405001)(5001770100001)(1220700001)(3846002)(189998001)(5002640100001)(83716003)(19580395003)(586003)(6116002)(1096002)(102836003)(106116001)(54356999)(76176999)(50986999)(92566002)(36756003)(33656002)(2950100001)(82746002)(104396002);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR02MB300;H:BY2PR02MB298.namprd02.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-8-i" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: zend.com X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Mar 2016 18:09:34.8833 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 32210298-c08b-4829-8097-6b12c025a892 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR02MB300 Subject: Re: [PHP-DEV] [RFC Discussion] Typed Properties From: zeev@zend.com (Zeev Suraski) > On 31 =E1=EE=F8=F5 2016, at 20:48, "guilhermeblanco@gmail.com" wrote: >=20 > To me it's simply as that: >=20 >=20 > class_statement: > variable_modifiers optional_type property_list ';' { $$ =3D $2; > $$->attr =3D $1 } > | ... >=20 > property_list: > property_list ',' property { $$ =3D zend_ast_list_add($1, $3); } > | property { $$ =3D zend_ast_create_list(1, ZEND_AST_PROP_DECL, $1);= } > ; >=20 >=20 > I think this makes the concept more palatable compared to others and othe= r > languages (single type declaration per statement). >=20 Exactly (code version). >> Honestly I never even realized that you could put multiple declarations = on >> a single line, have never done so, and would reject code from any of my >> projects that did so as poor style. :-) That said, since it is legal I >> agree that it should be kept unambiguous and consistent. >>=20 >> From what Zeev is saying, the following seems like a reasonable rule: Yo= u >> get ONE visibility modifier and ONE type statement per declaration, and >> both must come at the beginning, period. That is, the following are leg= al: >>=20 >> public int $a, $b; >> protected $a, $b; >> var int $a, $b; >>=20 >> And always apply across the entire line, period. >>=20 >> The following are all syntax errors: >>=20 >> public int $a, string $b; >> var int $a, protected $b; >> private $a, float $b; >>=20 >> That seems fairly easy for a reader to follow, reasonably consistent, an= d >> I presume straightforward to implement (not being a C developer I hand-w= ave >> that part...). If you want to do something more complex... make it >> multiple statements. That's why multiple statements exist. >>=20 >> Zeev, is that an accurate summary of what you're arguing? >>=20 Exactly (human version :) Zeev