Re: PHP 4.0 Bug #2675 Updated: Misbehavior of object initializers

From: Date: Mon, 08 Nov 1999 15:12:19 +0000
Subject: Re: PHP 4.0 Bug #2675 Updated: Misbehavior of object initializers
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-12220@lists.php.net to get a copy of this message
> >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. <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> > >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. > 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). > 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. Thanks, -------------------------------------------------------------------------------- | Jason "ZeroDiVide" Orcutt "Code is life is Code" | | Prometheus Project - http://prometheus.zerodivide.net | --------------------------------------------------------------------------------

« previous php.dev (#12220) next »