Fwd: Re: [PHP-PEAR] PEAR::isError()

From: Date: Mon, 04 Dec 2000 20:03:49 +0000
Subject: Fwd: Re: [PHP-PEAR] PEAR::isError()
Groups: php.dev 
Request: Send a blank email to php-dev+get-40032@lists.php.net to get a copy of this message
In case core people interested in this aren't on the pear list... ----- Forwarded message from "Stig S. Bakken" <ssb@fast.no> ----- Date: Mon, 04 Dec 2000 20:38:17 +0100 From: "Stig S. Bakken" <ssb@fast.no> Reply-To: "Stig S. Bakken" <ssb@fast.no> Subject: Re: [PHP-PEAR] PEAR::isError() To: Chuck Hagenbuch <chuck@horde.org> Chuck Hagenbuch wrote: > > I'd like to modify PEAR::isError() to NOT take its argument by reference. I > understand that this may incur a performance penalty. However, I think that > the readability/useability increase of being able to do: > > if (PEAR::isError(function($vars ...))) { > // do error stuff > } > > ... is worth it. Right now we can't do the above unless function() is defined > to return a reference, and you're going to want to check sucess or failure of > non-reference methods sometimes. > > The current situation I have in mind that exemplifies this is Net/SMTP.php; it > has a lot of lines such as: > if (PEAR::isError($this->socket->connect($this->host, $this->port))) > ... this doesn't work, and even with Andi's fix won't work, because > $socket->connect() returns TRUE on success, which is not a variable, and so > can't be passed by reference. > > Any objections? None here. But it kinda sucks that call-time references are obsoleted and at the same time you can't pass non-variables. Andi? - Stig ----- End forwarded message -----

« previous php.dev (#40032) next »