Re: Fwd: Re: [PHP-PEAR] PEAR::isError()
| From: | Andi Gutmans | Date: | Mon, 04 Dec 2000 20:50:40 +0000 |
| Subject: | Re: Fwd: Re: [PHP-PEAR] PEAR::isError() | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-40040@lists.php.net to get a copy of this message | ||
Why does it make sense to send constants by reference?
Andi
At 03:03 PM 12/4/00 -0500, Chuck Hagenbuch wrote:
In case core people interested in this aren't on the pear list... ----- Forwarded message from "Stig S. Bakken" <ssb@fast.no> -------- Andi Gutmans <andi@zend.com> http://www.zend.com/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 ----- -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net