Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45826 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23362 invoked from network); 15 Oct 2009 15:22:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Oct 2009 15:22:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=tom@punkave.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=tom@punkave.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain punkave.com from 209.85.217.218 cause and error) X-PHP-List-Original-Sender: tom@punkave.com X-Host-Fingerprint: 209.85.217.218 mail-gx0-f218.google.com Received: from [209.85.217.218] ([209.85.217.218:49042] helo=mail-gx0-f218.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 20/06-14330-81E37DA4 for ; Thu, 15 Oct 2009 11:22:01 -0400 Received: by gxk10 with SMTP id 10so1022182gxk.3 for ; Thu, 15 Oct 2009 08:21:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.80.7 with SMTP id d7mr302477anb.43.1255620117881; Thu, 15 Oct 2009 08:21:57 -0700 (PDT) In-Reply-To: <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> <9C9D1F74-673E-4275-9023-B8E7A4197D79@stefan-marr.de> Date: Thu, 15 Oct 2009 11:21:57 -0400 Message-ID: To: Stefan Marr Cc: Lukas Kahwe Smith , Stanislav Malyshev , internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Request for Comments: Horizontal Reuse for PHP From: tom@punkave.com (Tom Boutell) On Thu, Oct 15, 2009 at 10:42 AM, Stefan Marr wrote: > 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. Could you elaborate a little? I'm having trouble understanding why we can't just implement trait properties according to exactly the same policy we're using for methods with regard to conflict resolution/renaming and all the rest of it. >> 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. > > 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. So the trait would continue to use this tactic (runtime assignment to previously undeclared properties) internally, and wrap that in getters and setters... Will PHP ever include optional warnings for the use of undeclared properties? If so, then it doesn't make sense to also institutionalize their use as the only right way to have state in traits. -- Tom Boutell P'unk Avenue 215 755 1330 punkave.com window.punkave.com