Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35715 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90074 invoked by uid 1010); 22 Feb 2008 01:23:20 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 90059 invoked from network); 22 Feb 2008 01:23:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Feb 2008 01:23:20 -0000 Authentication-Results: pb1.pair.com header.from=steph@zend.com; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=steph@zend.com; spf=permerror; sender-id=softfail Received-SPF: error (pb1.pair.com: domain zend.com from 64.97.136.136 cause and error) X-PHP-List-Original-Sender: steph@zend.com X-Host-Fingerprint: 64.97.136.136 smtpout0136.sc1.he.tucows.com Solaris 8 (1) Received: from [64.97.136.136] ([64.97.136.136:48422] helo=n066.sc1.he.tucows.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7F/B1-64513-4042EB74 for ; Thu, 21 Feb 2008 20:23:19 -0500 Received: from sc1-out09.emaildefenseservice.com (64.97.139.2) by n066.sc1.he.tucows.com (7.2.069.1) id 4769F9180077D37F; Fri, 22 Feb 2008 01:22:47 +0000 X-SpamScore: 2 X-Spamcatcher-Summary: 2,0,0,6caf3d27af8e3cb9,ecb26adc12641bba,steph@zend.com,-,RULES_HIT:355:379:539:540:541:542:543:567:599:600:601:945:946:960:967:973:980:988:989:1155:1156:1260:1277:1311:1313:1314:1345:1437:1515:1516:1518:1534:1542:1587:1593:1594:1711:1730:1747:1766:1792:2073:2075:2078:2198:2199:2377:2379:2393:2525:2551:2553:2559:2563:2682:2685:2693:2736:2828:2857:2859:2933:2937:2939:2942:2945:2947:2951:2954:3022:3027:3355:3865:3866:3867:3868:3869:3870:3871:3872:3873:3874: 3934:3936:3938:3941:3944:4184:4250:4886:5007:6119:6120:6261:7576:7653:7679:7875,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:none,DNSBL:none X-Spamcatcher-Explanation: Received: from foxbox (62-31-252-198.cable.ubr07.shef.blueyonder.co.uk [62.31.252.198]) (Authenticated sender: steph.fox) by sc1-out09.emaildefenseservice.com (Postfix) with ESMTP; Fri, 22 Feb 2008 01:22:45 +0000 (UTC) Message-ID: <005e01c874f1$8e139ed0$c6fc1f3e@foxbox> Reply-To: "Steph Fox" To: , "D. Dante Lorenso" Cc: "Internals Mailing List" References: <001c01c87264$3c01b4e0$b4051ea0$@de> <698DE66518E7CA45812BD18E807866CE014A8D9D@us-ex1.zend.net> <47BE0664.8060304@stefan-marr.de> <47BE0A09.6060702@lorenso.com> <47BE0CC4.1090202@stefan-marr.de> Date: Fri, 22 Feb 2008 01:23:33 -0000 Organization: Zend Technologies MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Subject: Re: [PHP-DEV] Re: Traits for PHP ... Why can't every Class be a Trait? From: steph@zend.com ("Steph Fox") I hate to piss on anybody's bonfire, but... I'm not, never was, an OO fan. OO is one of those things I'm more and more forced to deal with... even in C coding (wtf is that all about?). It's OK, I won't create this OO stuff but I can deal with it when I see it... nowadays. But I also remember asking what 'void' meant when I first started out. I remember not understanding 'return', never mind the clever stuff with classes and all that. Everybody's getting so excited about how they can make OO in PHP better. I just see another thing I'll need to learn about if it goes into core. It's not a major problem to me, I'm just looking at whether I'd have been attracted to PHP all those years ago if it had been as it is now, never mind if it gets extra Java-esque features. All I'm seeing here is people with CS degrees saying trait would be cool. What about us peasants? Or am I the last living peasant? :\ That's possible, I suppose. Sell it to me? - Steph ----- Original Message ----- From: "Stefan Marr" To: "D. Dante Lorenso" Cc: "Internals Mailing List" Sent: Thursday, February 21, 2008 11:44 PM Subject: Re: [PHP-DEV] Re: Traits for PHP ... Why can't every Class be a Trait? > Hi, > > D. Dante Lorenso schrieb: >> All, >> >> I can imagine a case where you would want to box common functionality >> into a trait and be able to use that trait as a class also. Will we end >> up with a lot of classes like this?: >> >> class SomeClass { >> use SomeTrait; >> } >> >> What's wrong with making all 'Class'es be 'Trait's and the only thing >> which makes a Trait a Trait is when you use it as such? >> >> class MyClass { >> trait SomeClass; >> } >> >> In other words, why mustn't a trait be instantiable? Why can't every >> Class be a Trait? > > Well, the trait concept is not a silver bullet for all problems out there. > > What is wrong with inheritance or delegation for reusing complex behavior? > Traits are for finer grained reuse in my eyes. > The usage I've seen so far suggests typical traits are about 1 to 5 > methods, but the average method count on a trait would be 1.88 or > something like this (just a rule of thumb. from what I personally have > looked at). > > Kind Regards > Stefan > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >