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" <[EMAIL PROTECTED]>
To: "D. Dante Lorenso" <[EMAIL PROTECTED]>
Cc: "Internals Mailing List" <internals@lists.php.net>
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


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to