Re: Re: [Call for Votes] HTTP_Download

From: Date: Thu, 02 Oct 2003 07:46:32 +0000
Subject: Re: Re: [Call for Votes] HTTP_Download
References: 1 2 3 4 5 6 7 8 9  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-22297@lists.php.net to get a copy of this message
# cox@idecnet.com / 2003-10-02 00:35:23 +0200: > Wednesday, October 1, 2003, 9:15:52 PM, Roman Neuhauser wrote: > > if (...) { > > $this = PEAR::raiseError(...); > > return; > > } > > Oh, that's just ugly. If you need to return an error in the > constructor just use a static factory like method. > > Instead of: > > $a = new HTTP_Download(); > > do: > > $a = HTTP_Download::factory() or instance() or whatever. > > Inside that class you return a new HTTP_Download object, error or what > you want. # tuupola@appelsiini.net / 2003-10-02 10:01:06 +0300: > On Wed, 1 Oct 2003, Roman Neuhauser wrote: > > if (...) { > > $this = PEAR::raiseError(...); > > return; > > } > > No no no. You can't return anything else but instance > of object itself from the Constructor (or you can > or could, but that is/was considered a bug and not > a feature). I don't care as long as there is a way for the constructor to raise an error. Not that it would matter in the case we're talking about, where the condition can be detected outside the object, but there are cases where the ability to detect a problem is limited to the instance. -- If you cc me or remove the list(s) completely I'll most likely ignore your message. see http://www.eyrie.org./~eagle/faqs/questions.html

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