On Sat, 2004-01-24 at 03:06, [EMAIL PROTECTED] wrote:
> So why must we all keep implementing it?

Well, because you'd probably not like it the way I'd like to see it (or
the other way around), someone else probably prefers PEAR's, Horde's,
$random_other_php_framework's solution, and so on.

Plus, as was already said, and to which I agree, not every class should
have a constructor. If it did, you'd have a noticeable and unnecessary
memory overhead, especially when you're creating big amounts of objects.

There are more reasons which do not necessarily have to do with
performance or memory consumption but rather with how one thinks a base
class should be designed - see what I mean by personal preferences?

All in all, I don't think it would be a good idea if PHP forced this on
you. What would be basically OK if you had the _option_ of having such a
base class. But then again, why not simply write one for yourself? It's
not like any programmer utilizing OOP *doesn't* use any sort of
include(s) in where his/her classes reside. Add it there and you're all
set up.

It's basically the same with the built-in exception class. I can't have
my own (at least not with the sexy-most name "Exception"). Then, in my
(very personal) view I want it designed differently, and want to have it
extend _my_ base class (which, incidentally, is called "Object" and does
_not_ have constructor:)) - again, this is _my_ very personal feeling
about how it should be - so I'll just have my own exception, which is
perfectly OK and dealt with very well by the Zend Engine.

I'm not the only PHP user out there with his or her own understanding of
subtleties in class design (new Reflection_Class("xxx") vs.
Reflection_Class::forName("xxx"). As for base classes, whip up Google,
search for object.php and see for yourself.

- Timm

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

Reply via email to