Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92833 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88045 invoked from network); 27 Apr 2016 07:27:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Apr 2016 07:27:42 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 65.55.169.138 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 65.55.169.138 mail-bl2on0138.outbound.protection.outlook.com Received: from [65.55.169.138] ([65.55.169.138:14862] helo=na01-bl2-obe.outbound.protection.outlook.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 77/32-20013-AE960275 for ; Wed, 27 Apr 2016 03:27:41 -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=wrY/DJXs+WtjkEQzdKhzhPJHT66wqS7CV/6o/yfDV1k=; b=wbE1bGCxLwL/Ep+3x2834HjUi0d2XKPKRs6iQaDgS5OGjyYV5z2pqeuKSJ9xI0Sgzt/DlcqIuk5SfIi+KUVgbeRWx/x08D0RYXXM8q6uXNeS6kzKjfyYB6kVPrEmRjl+U198H57OXrzA4uVPcvMaSl4MzbSXLBBC0ie+Kg/BiAw= Authentication-Results: lists.php.net; dkim=none (message not signed) header.d=none;lists.php.net; dmarc=none action=none header.from=zend.com; Received: from tpl2.home (92.62.57.172) by BY2PR0201MB1782.namprd02.prod.outlook.com (10.163.72.24) with Microsoft SMTP Server (TLS) id 15.1.477.8; Wed, 27 Apr 2016 07:27:33 +0000 To: Pierrick Charron , Dominic Grostate References: <571DD94B.3060604@zend.com> <571E63D0.8080800@gmail.com> <9c24f969-cb0e-cb46-a23c-6e06e7de7d79@gmail.com> <571E7C08.6010309@gmail.com> <571F1B95.9030203@zend.com> CC: PHP internals Message-ID: <572069DD.9010708@zend.com> Date: Wed, 27 Apr 2016 10:27:25 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------080600030104060309060604" X-Originating-IP: [92.62.57.172] X-ClientProxiedBy: BY2PR07CA053.namprd07.prod.outlook.com (10.141.251.28) To BY2PR0201MB1782.namprd02.prod.outlook.com (10.163.72.24) X-MS-Office365-Filtering-Correlation-Id: 32d19a95-6b65-4ad4-7c4f-08d36e6d6718 X-Microsoft-Exchange-Diagnostics: 1;BY2PR0201MB1782;2:5G5BhgyHR0Qio9Iwfli1KZB1hKbHw1ngxwqtTcrMP4Aclb+zt8/NByNAz/5aWxTd5KT0Ef0WLIfRpTNlKInA1GSaoVxQY/AZ3WEPj5lyF1O0v0cbRIa/SKPQRAU6bR67tt8hdZyYaKtYfQ4Xza1gi8ulKuPiH4nb6jb1d4IxGxPJUEXa6q9YWosKaj4ETc60;3:ZtDNBnD0A7Za1C8eWptn05KNKHAvkBNvxSPzOiID00PrRUhI/uep9g3OSanglaWYt2rSiabd/uFZXGls3MKs9ZlumzEakeQ/T+y7s93w/F+tbaTRsujBH3OzdDCNf1RH;25:73p+ou6mVrz5obPDXckjnHXDxaD9gEUatfekzYhBsyt0qg5/W7YAiBPmb162ULwbdnUZ8dLC1DS+I9lNR7W+nVzVUMh2jh/7XAJkd0VrUdG1RUmtmIpJXNTFuSa+f6FnLInsFGhxLRyi6MqSzB+OKp/3HV+zbPfmuOZa9R+2lem/Mu9K06LvEDWGBAKvP/pmbU1v5jWm7VBlh9KGR8P7+VyLM9EBTg0k6fFD4uhj2SQ17kswD7tFVmZ2hDAEFAt/8CoJcw7tLy8C1tHBw8VnEr5TaaA3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== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(9101521072)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001);SRVR:BY2PR0201MB1782;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0201MB1782; X-Forefront-PRVS: 0925081676 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(53754006)(24454002)(377454003)(15975445007)(586003)(2950100001)(5004730100002)(1096002)(2906002)(4326007)(5890100001)(6116002)(81166005)(77096005)(36756003)(33656002)(3846002)(42186005)(16236675004)(19617315012)(65956001)(19580395003)(65806001)(66066001)(86362001)(84326002)(64126003)(189998001)(270700001)(59896002)(54356999)(87266999)(92566002)(4001350100001)(5008740100001)(5001770100001)(65816999)(76176999)(80316001)(19580405001)(50986999)(93886004)(512874002);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR0201MB1782;H:tpl2.home;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR0201MB1782;23:iP+LUcS0HL6DzK2TuUJpVVY/JkQ/WHxUK6Gy/Ky?= =?us-ascii?Q?5daweZLkcSPohkj+Pm2vwCaniHHCcR8hGoZFLqigp6WI/22h7EAZJPdfTppe?= =?us-ascii?Q?w/WLDbW6V4SdDy7zhydEPuSOcztDb+AkMZ8FLTyFZqmRb+zs37Bgo2KQ8WB4?= =?us-ascii?Q?mfghZaYncwTLLWxAVYspKNHVAywRP/UMb+KwaYYvadsu3txTFeBKYZq+5s/A?= =?us-ascii?Q?3WnYsAjwzp/VGTFyCUtpYMjTr4tLfc+y4hRbZr26kuxvq4u2rsUiCURbcLPr?= =?us-ascii?Q?tVUZf2kLobbVddWNP+cXC05NrYWdEEjiYhzRVPf/LexiAfxpw0TRomg6K9Dc?= =?us-ascii?Q?G2bk7WxeN2LxgK+5BtVCsBMnpz27CS75szozWHr/qmk9j2/qoGLKLXSmiMiM?= =?us-ascii?Q?eXGqLqb4XtxDEAQ0DxjfDYCNib7OQuygB/2kj+ivXlvp+ZytU+2wvztXQIko?= =?us-ascii?Q?ASL6PAb2vHsz8GUtR/np76HbUEOs74eWI/kD2OPr/6ILaMFg8TwHgpAEffzz?= =?us-ascii?Q?89WtJSDhIEKahxiGhYDgCM+oxWjJm4YPvt/y1Qr0xSjY6bYgZlbm6H3Tpbln?= =?us-ascii?Q?cTYStE2iF+6NlhybGm1Zg7O7UU67TVJZVtr8VxQykadRuJ+GJYpSEwsbmj7x?= =?us-ascii?Q?cH6XMmZ+E25yzLtNMfiJoKuq+TibdeHGugIoGQCq5tUPg2yDHu5KkPYzltKj?= =?us-ascii?Q?teekfj3nbPwEXwBQx31g8YSJmTEjYLBhp1NdQBDVNmzDhthsULXBCJyIiZn7?= =?us-ascii?Q?Ep2ZxN6QNrR8HFhhrbmTXR91fIjF1rX/emfZZmoa5bqj6bcI2RAK0pgpkT//?= =?us-ascii?Q?pEySkSAyts7CHtThlzZ7BfBCg+HfrSi8IljYWJzHpZ4119AYvmSIwoYpjLMp?= =?us-ascii?Q?pMAj/WEAgQwPXnhxwPHGVKOOBo2nEFEgO7wsZFpqBduQVzv6KcBDOCnm92vT?= =?us-ascii?Q?KP1hY58yo4xb/jIbFNKhiQpjowJUsx69X7s3+GC3zIliNxGaaY36gTurXC6x?= =?us-ascii?Q?O+hz8MOGnL3MtxQ3sybitsnZtYB+/Jvtdfakl2RsFqsFeODCpPx5XgBd30ew?= =?us-ascii?Q?Zco6u0E1jG/wKBYBZU3rP8s9xWwWMFobDjxKgEJ/VZWFuMlqLkjoV7Vb6Duo?= =?us-ascii?Q?VquqMpVDeS/zpI278evYavafqZE6ixVOQeXd2U7UFebCeDMlGHa6iPF82mqv?= =?us-ascii?Q?gOp7nUowDMMso8lk=3D?= X-Microsoft-Exchange-Diagnostics: 1;BY2PR0201MB1782;5:lDMxrlT0tV1N0oa2P2AEIWLXwwXBMCPyWQ2mbWBPFn0dTyiBUcoj5FqzNYBFgPzafqut5SdvF2fkgy3JZZ53I6JY0iGeHy4bEm/UvyGT8OoXQaV57dYCtNuGGErfv9YTw31M/GKrnBY8oxRnH1KmIw==;24:e93tA1pLbziBFVZe9lNczkuW5xs1Gb7abcH4abYcey0Loc/l1ujZWOvnyZo4jCR5wEBX6cTV9PRlChZcHv35F/eLsF2zfBemztXJo2a+8Pw=;7:jt2LK340PkxidGc11t8tSY9XmfMT2qJMse7M+kTPMvzVfjyjHml7A34Dbck4VSy1P6GTqc2p4uqy4RVre2BocRn6rJL2RvnYb7f8NywL/Lncztk7t83iePRPDeGEfqnGBvguQQGG86hJ6N7T/5OQ4hxPnusYJCgMBUUx/0v0bXSH101ldRcJNpUoeTOHumiH SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: zend.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2016 07:27:33.7488 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0201MB1782 Subject: Re: [PHP-DEV] [RFC] PHP Attributes From: dmitry@zend.com (Dmitry Stogov) --------------080600030104060309060604 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit On 04/27/2016 08:25 AM, Pierrick Charron wrote: > Hi all, > > First of all thanks dmitry for your great work and for bringing the > RFC back to life. > > I think it would be great to allow users to define their own > annotations and give them some structure (what the annotation is made > of). For example let's say I apply an annotation to define that a > property is a string with a length. In the proposed RFC I will have > something like this : > > class Foo { > <> > public string $bar; > } > > But how could i know for example that StringLength can take an extra > parameters I would have to read the code of the annotation framework > see how it parse, use it etc... But if I can define the structure > (this is a quickly invented pseudo syntax and I'm not proposing it) > > annotation MyAnnotation\StringLength { > private int $length; > private string $comment = "Default value"; > } > > With this definition I know that the Annotation take 2 parameters one > int and one string, that the comment has a default value and can be > omitted etc... > > Also what I dislike about using a simple array with no definition is > that you can't annotate an annotation since there is no definition. I > know it can look complex but think about the power you can add to the > system. It would help us solve some problems that could not be solved > (or at least I can't see any way of doing it) if you can't have a > definition you can't attach behaviour/metadata to it. > > Here are some problems we could solve (those are just examples) > > 1. Are annotations inhereted or not ? Some will say yes, some now but > I think they actually both make sense. For example we could imagine > that if I annotate a method of my interface as deprecated I want it to > be inhereted because all implementations are, but author annotation > should not be inherited because I'm not necessarily the author of the > implementation. So we could say that annotations are by default not > inherited and we could have an <> annotation > > <> > annotation deprecated { > } > > annotation author { > public string $name; > public string $mail; > } > > 2. Is a specific kind of annotation applicable to only one kind of > statement or multiple ? JIT don't make sense on a property... > > <> > annotation jit { > } > > 3. Current version of the RFC propose that we could either have AST or > to execute the AST but we could imagine to get both > > annotation assert { > <> > public ast\node $node; > public string $message; > } > > Again, this is just a couple of quick ideas, but this would make > things less magic/obscure with a definition and far more flexible. If > we agree that we want a definition we could work on how to create this > definition (we could use some stuff from the old Annotations RFC > https://wiki.php.net/rfc/annotations?rev=1302087566) to update this > one with a new syntax or use interface as proposed in the first > implementation > > class Deprecated implements Annotation { > } > > Maybe didn't you think, that these annotation over-design made your RFC fail? You can't create objects at compile-time, and should delay their creation until Reflection*::getAttributes(). Returning objects directly form Reflection*::getAttributes() doesn't improve flexibility at all. This would just increase the complexity of the patch... As I already said many times, all this extensions are possible to do in few PHP lines on top of base functionality. See "Doctrine use-case" at https://wiki.php.net/rfc/attributes#use_cases If you add these extensions directly into PHP implementation in C, you''ll have to support them, and you'll always miss some needs for "last use-case", but you won't able to change PHP behavior between major PHP versions. Thanks. Dmitry. > > Pierrick --------------080600030104060309060604--