Re: [PHP-DEV] PHP 4.0 Bug #2675 Updated: Misbehavior of object initializers From: Andi Gutmans (andi <email protected>)
Date: 11/08/99

At 09:12 AM 11/8/99 -0600, ZeroDiVide wrote:

> > >Is there a design paper or anything that shows where things are headed
> > >with the oop side of things?
> >
> > Actually we never intended to make PHP a completely OOP language. We added
> > some support to allow creation of self contained packages. We are not at
> > this time heading in a completely OOP direction. Most PHP users still
> > prefer to write simple procedural programs for their web sites than OO
> > programs.
>
>I understand this point, but there are a growing number of oop programers,
>and oop questions within #php and code snippets on px exchange. I'm not
>arguing to convert php to a completly oop language, which would probably
>kill every speed benifit in it. What i do ask is for a non fragmented oop
>superclass, the ability to polymorph and do multiple inheritence.

Well you have inheritance in PHP (I don't think not having multiple
inheritance is a big deal; Java doesn't have it either and it's more OOP
oriented than C++).

><PersonalRant type="J">
>I'm not a big fan of c++ denotation or calling a blind function
>MyObject::Foo(). I belive that having a mix of the symantics from c++ and
>java is a feature, but i hope that we are not going lean too heavily on
>the c++ model. I know i'm not a core developer, so most of these comments
>should proably taken with a grain of salt. I do appriciate all of the hard
>work you guys do.
></PersonalRant>

We tried to take a few convenient features both from C++ & Java. As I said,
we won't be going fully OOP in the near future and will therefore not lean
strongly on any of these languages.

> > >Right but wouldn't it be easy to have the function default to returning
> > >$this and if you don't want to or you want to polymorph into something
> > >else you'll return a different object reference or whatever you'd like.
> >
> > No, because not all classes have constructors.
>
>A superclass traditionally contains a default constructor that the child
>objects inherit as their own.

Well in any case you can call your parents constructor or overloaded
function via the Class::method syntax.

> > Anyway, I really don't see a
> > point of allowing this and it sounds pretty odd to me that some other
> > languages do allow it.
>
>even perl allows for it (although objects in perl are a cludge IMHO).

I never quite understood how the hell the Perl OOP works. Perl really is a
cludge when it comes to OOP.

> > Also, there really is no problem with the code I
> > sent you. Why not use that?
>
>Code clarity for the user, most people coding php don't do oop, so when
>you say just dereference that factory method, they get lost really quick.

Well people who don't do OOP won't be creating the factories the way you
wanted either. I actually like the C++ approach which is pretty much the
way I wrote the factory. It also is very similar to what you did.

Andi

---
Andi Gutmans <andi <email protected>>
http://www.zend.com/

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>