Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92637 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26659 invoked from network); 22 Apr 2016 12:25:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Apr 2016 12:25:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 157.56.111.144 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 157.56.111.144 mail-bn1bon0144.outbound.protection.outlook.com Received: from [157.56.111.144] ([157.56.111.144:22981] helo=na01-bn1-obe.outbound.protection.outlook.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 59/84-14036-2670A175 for ; Fri, 22 Apr 2016 07:13:39 -0400 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=RAWz4hucjbsdZ+3yQKVnVLNL+Y11/hMBa4oTQCYKLHA=; b=qDE2nX4dO05hiS0BFvAGJrljKkrbhNo3o6n2je3yARGmdp0T44miruMzNGtbfsx/nGqyVO6s+emuIlQFO/S4vDtgDeIB1s9mlc7K/Xt9YmK50BRdYm14B+q4MiXs7zhybSf+EWF5AdwRmTKC0n8iBRihSEF9ashqOx+JJ2lC3nQ= Received: from BY2PR0201MB1784.namprd02.prod.outlook.com (10.163.72.26) by BY2PR0201MB1782.namprd02.prod.outlook.com (10.163.72.24) with Microsoft SMTP Server (TLS) id 15.1.466.19; Fri, 22 Apr 2016 11:13:34 +0000 Received: from BY2PR0201MB1784.namprd02.prod.outlook.com ([10.163.72.26]) by BY2PR0201MB1784.namprd02.prod.outlook.com ([10.163.72.26]) with mapi id 15.01.0466.023; Fri, 22 Apr 2016 11:13:34 +0000 To: Dominic Grostate CC: PHP internals Thread-Topic: [PHP-DEV] [RFC] PHP Attributes Thread-Index: AQHRnBAun0yJJJCyoUaLowSO4sZVN5+VD36AgAA6G4CAAGECRIAALPC5 Date: Fri, 22 Apr 2016 11:13:34 +0000 Message-ID: References: <571965D1.9020102@zend.com> , In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: lists.php.net; dkim=none (message not signed) header.d=none;lists.php.net; dmarc=none action=none header.from=zend.com; x-originating-ip: [92.62.57.172] x-ms-office365-filtering-correlation-id: d3dbb839-f3fd-4630-b28a-08d36a9f250f x-microsoft-exchange-diagnostics: 1;BY2PR0201MB1782;5:Azv4NJKIyB2uHeNyFr6cuIx5FQhRKXaxh9STZnoZat/9zhPVeJSv3YScYt7OJaAtfJ7iFJU+RILIshP9qobfeZT70J1Mz3jN0K28CJtXQUy7xWw+ovtnHyTbuOLA6zrtIDYbXa2b3T6patcrb4YO1GTlmq4RjqsO0tUQmDKsv+40e3FNw3O3LNDDOUN4xtmd;24:+tTrADAC993lQyOE0IMcHdqqLCG74GfNqv2w6ejPeESOkF9lWlihxuGNROTTgzarDbRy7jpBtYhRAVBoGfuQKlEW7yEDRa+AWoKSwrGbyNc=;7:M/g56En3fTB3VS7HqcdotahUX+uKM+SDV9Z+lumLoSU/4EvzO4Nz4VVQc/A9E6WFzybKfiYVwrVxZ9IGQ6/hAKiCqHMhdIJYGHTdsXttw7pHH6SiE/N13RaJSEZXo9gOj4vEE0JaFqMVLsJXN4woFXH3NpUKE7Uw/DMKRf5NmdDOnasgEqvH9pOav8yZHF3lDj6nZSmSZTZTegYXQDcdFb47R4tYUnJxUDXBa9KOm78= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0201MB1782; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(9101521026)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001);SRVR:BY2PR0201MB1782;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0201MB1782; x-forefront-prvs: 0920602B08 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(377454003)(24454002)(3900700001)(76176999)(19580395003)(54356999)(5008740100001)(5003600100002)(19625215002)(122556002)(2906002)(3280700002)(16799955002)(1096002)(3660700001)(5002640100001)(92566002)(93886004)(1220700001)(586003)(74316001)(110136002)(3846002)(189998001)(102836003)(19580405001)(6116002)(87936001)(16236675004)(66066001)(81166005)(5004730100002)(9686002)(4326007)(11100500001)(19627405001)(106116001)(86362001)(19617315012)(77096005)(2950100001)(2900100001)(15975445007)(10400500002)(33656002)(50986999);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR0201MB1782;H:BY2PR0201MB1784.namprd02.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: multipart/alternative; boundary="_000_BY2PR0201MB1784832421A06C2B244AE1B1BF6F0BY2PR0201MB1784_" MIME-Version: 1.0 X-OriginatorOrg: zend.com X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Apr 2016 11:13:34.2095 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 32210298-c08b-4829-8097-6b12c025a892 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0201MB1782 Subject: Re: [PHP-DEV] [RFC] PHP Attributes From: dmitry@zend.com (Dmitry Stogov) --_000_BY2PR0201MB1784832421A06C2B244AE1B1BF6F0BY2PR0201MB1784_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <> works fine sapi/cli/php attr6.php array(1) { ["Entity"]=3D> bool(true) } $ cat attr6.php > function foo() {} $r =3D new ReflectionFunction("foo"); var_dump($r->getAttributes()); ?> [dmitry@tpl2 CGI-DEBUG]$ sapi/cli/php attr6.php array(1) { ["Entity"]=3D> bool(true) } <> - doesn't work now, but I'll implement this and extend RFC o= n next week. Thanks. Dmitry. ________________________________ From: Dominic Grostate Sent: Friday, April 22, 2016 11:31 To: Dmitry Stogov Cc: PHP internals Subject: Re: [PHP-DEV] [RFC] PHP Attributes I'm having a crack at it now. Seeing if I can use it to plug a new Annotat= ion driver for Doctrine. Couple of things I've found so far are: <> with empty args doesn't work. <> namespace doesn't work. On the subject of using @, that could denote a class constructor, unless so= meone already mentioned that. On 22 Apr 2016 12:44 a.m., "Dmitry Stogov" > wrote: On 04/22/2016 02:16 AM, Dominic Grostate wrote: This is amazing. It would actually allow us to implement our automated ass= ertions ourselves, as opposed to requiring it within the language. this was the idea - to give a good tool instead of implementing every possi= ble use-case in the language. Could it also support references? <> function foo($a) { } yes. "&$a" is a valid PHP expression. If you plan to use this, I would appreciate, if you to build the patched PH= P and try it. The early we find problems the better feature we will get at the end. Thanks. Dmitry. On 21 Apr 2016 10:13 p.m., "Dmitry Stogov" > wrote: Hi, I would like to present an RFC proposing support for native annotation. The naming, syntax and behavior are mostly influenced by HHVM Hack, but not= exactly the same. The most interesting difference is an ability to use arbitrary PHP expressi= ons as attribute values. These expressions are not evaluated, but stored as Abstract Syntax Trees, a= nd later may be accessed (node by node) in PHP extensions, preprocessors an= d PHP scripts their selves. I think this ability may be useful for "Design = By Contract", other formal verification systems, Aspect Oriented Programmin= g, etc https://wiki.php.net/rfc/attributes Note that this approach is going to be native, in contrast to doc-comment a= pproach that uses not well defined syntax, and even not parsed by PHP itsel= f. Additional ideas, endorsement and criticism are welcome. Thanks. Dmitry. --_000_BY2PR0201MB1784832421A06C2B244AE1B1BF6F0BY2PR0201MB1784_--