Re: Re: namespaces?

From: Date: Sun, 15 Jul 2001 13:27:17 +0000
Subject: Re: Re: namespaces?
References: 1 2 3 4  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-777@lists.php.net to get a copy of this message
Erik Hjortsberg wrote: > > At 14:07 2001-07-15 +0200, you wrote: > >- Return in constructors. For me seems a little bit silly the need off > >providing an extra method to do the work and get the error back. > >$foo = new bar(); > >$err = $foo->build(); //or something similar > >if (PEAR::isError($error)) { .. } > > > >while you could simply do: > >$foo = new bar(); // or perhaps something like $foo = new::bar(); > >if (PEAR::isError($foo)) { .. } > > > > > >Tomas V.V.Cox > > Hmm, you can always do: > $foo = & bar::new(); > if (PEAR::isError($foo)) { .. } > > and do all of your init in new(). > Kinda like Smalltalk does it. > With you idea I should do: class Bar { function new($file) { // do things if ($error) { return $error; } return & new Bar; } } Instead of this strange thing I would probably prefer to provide a build() method. Someone some day, posted a curious system to do what I say: class Bar { function Bar() { if ($error) { // overwrite the object $this = $error; } } } But's ok, no more discuss on this topic as it has been clearly rejected :) Tomas V.V.Cox

« previous php.pear.dev (#777) next »