Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45825 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12997 invoked from network); 15 Oct 2009 14:42:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Oct 2009 14:42:41 -0000 Authentication-Results: pb1.pair.com header.from=php@stefan-marr.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@stefan-marr.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain stefan-marr.de from 85.88.12.247 cause and error) X-PHP-List-Original-Sender: php@stefan-marr.de X-Host-Fingerprint: 85.88.12.247 toolslave.net Received: from [85.88.12.247] ([85.88.12.247:58200] helo=uhweb12247.united-hoster.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A8/35-14330-ED437DA4 for ; Thu, 15 Oct 2009 10:42:39 -0400 Received: from soft83.vub.ac.be ([134.184.43.183]) by uhweb12247.united-hoster.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1MyRXA-0007D5-J3; Thu, 15 Oct 2009 16:42:32 +0200 Mime-Version: 1.0 (Apple Message framework v1074) Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes In-Reply-To: Date: Thu, 15 Oct 2009 16:42:24 +0200 Cc: Lukas Kahwe Smith , Stanislav Malyshev , internals@lists.php.net Content-Transfer-Encoding: 7bit Message-ID: <9C9D1F74-673E-4275-9023-B8E7A4197D79@stefan-marr.de> References: <002b01c92d67$ae92fdc0$0bb8f940$@de> <9D1CD88B-3A75-453C-9515-5F31E60F90AC@pooteeweet.org> <90CF2907-8C30-4EB0-9AC5-AD00EFC14023@stefan-marr.de> <4AD62E77.9010802@zend.com> <3530BC53-F4D6-48EC-BBEB-54E79AD497C3@pooteeweet.org> To: Tom Boutell X-Mailer: Apple Mail (2.1074) Subject: Re: [PHP-DEV] Request for Comments: Horizontal Reuse for PHP From: php@stefan-marr.de (Stefan Marr) Hi: On 14 Oct 2009, at 22:44, Tom Boutell wrote: > I'm very concerned about the practical consequences of introducing > traits without state. Well, we have not found a sufficient design until now, which would fit nicely into PHP from dynamic and simplicity perspective. > A. They could do this using static hashes in global variables or a > separate class. The result is a garbage collection failure as these > references to $this will never go away. Designed-in GC failures are > unacceptable post PHP 5.3. Doing this would be less than advisable. > B. PHP allows you to define properties at runtime. That is, you can > write: > > $this->title = 'my title'; > > Without declaring var $title; at the class level. > > But PHP 6 seems to be moving toward more strictness, not less, and > this style encourages the use of undeclared variables with the > resulting potential for missed bugs. Thats the currently preferred approach from my perspective. The only thing you are going to lose here is a notion of separation of state from different traits, compared to a language supported approach. However, if you prefer to be more strict, it is still perfectly possible to circumvent this problem by using getters and setters. > Also, the 'instead' keyword is baffling - it could mean replace A with > B or replace B with A depending on how you place your mental comma - I > much prefer the assignment syntax alternative, or 'insteadof' which is > unambiguous. Yes, that was discussed before, but unfortunately did not make it into the list of alternative syntaxes, will try to keep track of it. Best regards Stefan > > On Wed, Oct 14, 2009 at 4:07 PM, Lukas Kahwe Smith > wrote: >> >> On 14.10.2009, at 22:03, Stanislav Malyshev wrote: >> >>> Hi! >>> >>>>> So lets warm this up again. >>>>> HEAD is for development .. so lets get this into HEAD so that it >>>>> will be >>>>> part of the next bigger PHP release for sure! >>>> >>>> Well, the code is sitting here >>>> http://github.com/gron/php-src/tree/PHP_6-traits >>>> and waits to be merged. :) >>> >>> I thought before merging code it would be useful to have some >>> discussion >>> on if the code is actually doing what we want. If it's based on >>> http://wiki.php.net/rfc/horizontalreuse then for example I can see >>> some >>> potential issues for bytecode caching related to renaming and >>> changing >>> visibility. >>> Also, it is not clear that we want grafts there at all, some >>> aspects of >>> them seem to get too hairy, esp. $this issue or statics. >>> >> >> i think Stefan is fully aware of that probably there will be a >> discussion >> first .. >> but i think we all agree that this feature is very high on the list >> of what >> people want and therefore i wanted to get this discussion going, so >> that >> after its concluded traits can be commited to HEAD. >> >> regards, >> Lukas Kahwe Smith >> mls@pooteeweet.org >> >> >> >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > > > -- > Tom Boutell > P'unk Avenue > 215 755 1330 > punkave.com > window.punkave.com > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- Stefan Marr Software Languages Lab Former Programming Technology Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://prog.vub.ac.be/~smarr Phone: +32 2 629 3956 Fax: +32 2 629 3525