Re: stdClass
| From: | Jakes | Date: | Fri, 27 Feb 2004 15:06:49 +0000 |
| Subject: | Re: stdClass | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-8224@lists.php.net to get a copy of this message | ||
You calling it from the base so cleaning you be easier than
looking for object referenced variables and setting them to null.
Working in a large class hierarchy it could get painful.
"Michael Walter" <cm@leetspeak.org> wrote in message
news:403F5A6B.3000405@leetspeak.org...
> Jakes wrote:
> > Oh, yes and special methods that you mentioned would come in handy too
> > but from a object perspective. Maybe explicitly calling some sort
finalize()
> > method to clean un-referenced objects would also be handy.
> How does that differ from $x=null; with a reference-counting garbage
> collector?
>
> Cheers,
> Michael
>
> >
> > ----- Original Message -----
> > From: "Jakes Potgieter" <jakespotgieter@hotmail.com>
> > Newsgroups: php.internals
> > To: <hartmut@php-groupies.de>
> > Cc: <internals@lists.php.net>; "Stephan Schmidt"
> > <schst@php-tools.net>
> > Sent: Friday, February 27, 2004 4:42 PM
> > Subject: Re: [PHP-DEV] stdClass
> >
> >
> >
> >>When Im talking about something like this would come in handy
> >>obviously doesnt work! The paramter null could be added, to get
> >>desired result but to be programmatically correct:
> >>
> >>class MyOverload{
> >> function __construct($Foo) {
> >> $this->Foo = $Foo;
> >> }
> >> // overload the constructor
> >> function __construct(String $Foo, String $Bar){
> >> $this->Foo = $Foo;
> >> $this->Bar = $Bar;
> >> }
> >> public function doSomething(){
> >> if($this->Foo != null && $this->Bar == null){
> >> return $this->Foo . " needs a partner";
> >>// do something with Foo
> >> }elseif($this->Foo != null && $this->Bar != null){
> >> return $this->Foo . " and " . $this->Bar . " are
> >> partners";
> >
> > //do
> >
> >>something with Foo and Bar
> >> }
> >> }
> >> private $Foo;
> >> private $Bar;
> >>}
> >>
> >>$obj = new MyOverload("Mary");
> >>print $obj->doSomething();
> >>
> >>
> >>----- Original Message -----
> >>From: "Hartmut Holzgraefe" <hartmut@php.net>
> >>To: "Jakes Potgieter" <jakespotgieter@hotmail.com>
> >>Cc: "Stephan Schmidt" <schst@php-tools.net>;
> >><internals@lists.php.net>
> >>Sent: Friday, February 27, 2004 4:20 PM
> >>Subject: Re: [PHP-DEV] stdClass
> >>
> >>
> >>
> >>>Jakes Potgieter wrote:
> >>>
> >>>>It would be nice to have a base class to inherit some special
> >>>>methods as we do in Java.
> >>>
> >>>could you name which ones you think of?
> >>>
> >>>being out of the JAVA camp for several years know i no longer
> >>>know all java.object methods and properties by heart, but
> >>>PHP mechanisms like __sleep()/__wakeup(), __toString() and
> >>>the introspection related functions like get_class() and
> >>>friends should provide comparable behaviour ...
> >>>
> >>>(IMHO the fact that any object in JAVA can be casted down
> >>> to java.object is not that clever after all, and part of it
> >>> is only due to the fact that there is no other way to have
> >>> portable container classes, which is now finally solved
> >>> with generics)
> >>>
> >>>
> >>>>The same as method overloading,
> >>>>one of the most important aspects missing in PHP5 and the
> >>>>new object model.
> >>>
> >>>due to the feature of optional parameters you may end up with
> >>>more than one overloaded function matching a call signature,
> >>>due to the fact that argument types in a function call
> >>>are not known at compile time signature matching would have
> >>>to happen at runtime,
> >>>and the language syntax would need to be extended to add
> >>>parameter type specifiers to function parameter declarations
> >>>(ok, we already have this one for interfaces ...)
> >>>
> >>>--
> >>>Hartmut Holzgraefe <hartmut@php.net>
> >>>
> >