Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51115 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67982 invoked from network); 22 Dec 2010 15:39:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Dec 2010 15:39:53 -0000 Authentication-Results: pb1.pair.com header.from=jbondc@openmv.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=jbondc@openmv.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain openmv.com from 64.15.152.204 cause and error) X-PHP-List-Original-Sender: jbondc@openmv.com X-Host-Fingerprint: 64.15.152.204 mail.ca.gdesolutions.com Received: from [64.15.152.204] ([64.15.152.204:64613] helo=mail.ca.gdesolutions.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 24/D4-43783-5CB121D4 for ; Wed, 22 Dec 2010 10:39:50 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.ca.gdesolutions.com (Postfix) with ESMTP id 75ED05D4C; Wed, 22 Dec 2010 10:39:47 -0500 (EST) X-Virus-Scanned: amavisd-new at gdesolutions.com Received: from mail.ca.gdesolutions.com ([127.0.0.1]) by localhost (mail.ca.gdesolutions.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3Sxf-jz2SpMl; Wed, 22 Dec 2010 10:39:47 -0500 (EST) Received: from djbondc (modemcable083.208-56-74.mc.videotron.ca [74.56.208.83]) by mail.ca.gdesolutions.com (Postfix) with ESMTP id 038CA5D36; Wed, 22 Dec 2010 10:39:46 -0500 (EST) To: "'Stefan Marr'" , Cc: References: <89C52156-CF92-4DDB-8BA4-4ABF6883512C@stefan-marr.de> <201012132027.59678.larry@garfieldtech.com> <76C593EE-BCCA-4BBD-B625-B6AE9340B20C@stefan-marr.de> <73.1D.35939.D413E0D4@pb1.pair.com> <8F.32.11788.5FF5F0D4@pb1.pair.com> <4D0F7E99.8050705@garfieldtech.com> <764A364B-173B-401B-83FA-A61D45BE99CB@stefan-marr.de> In-Reply-To: <764A364B-173B-401B-83FA-A61D45BE99CB@stefan-marr.de> Date: Wed, 22 Dec 2010 10:39:46 -0500 Message-ID: <002d01cba1ee$7671d0d0$63557270$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcugnL0246Y+ghM1R8qOsT+qOIn2kwAde4Vg Content-Language: en-ca Subject: RE: [PHP-DEV] Traits and Properties From: jbondc@openmv.com ("Jonathan Bond-Caron") On Mon Dec 20 06:21 PM, Stefan Marr wrote: > > ===== Handling of Properties/State ===== > > This property handling was implemented in > [[http://svn.php.net/viewvc?view=revision&revision=306476|SVN revision > 306476]] and examples are given in the test cases. > +1 The E_STRICT warning seems to follow nicely the paper's view that a stateful trait should be its own 'black-box': http://scg.unibe.ch/archive/papers/Berg07eStatefulTraits.pdf There are two remaining questions I have: 1) How do traits affect the reflection API? 2) Do we want to be able to declare trait requirements for properties and methods? If so what syntax? A note on the syntax proposed by Nathan: trait require Foo An option could be: trait Foo { require { public $var; function ratio(); } function doFoo($v) { $this->var = $v * $this->ratio(); } } trait Bar { require interface Iterator; } The idea comes from: http://code.google.com/p/es-lab/wiki/Traits I found this trying to look for alternative keyword for 'require'.