Re: [PHP-DEV] Fwd: Re: [PHP-PEAR] PEAR::isError() From: Andi Gutmans (andi <email protected>)
Date: 12/04/00

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 <email protected>> -----
> Date: Mon, 04 Dec 2000 20:38:17 +0100
> From: "Stig S. Bakken" <ssb <email protected>>
>Reply-To: "Stig S. Bakken" <ssb <email protected>>
> Subject: Re: [PHP-PEAR] PEAR::isError()
> To: Chuck Hagenbuch <chuck <email protected>>
>
>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 <email protected>
>For additional commands, e-mail: php-dev-help <email protected>
>To contact the list administrators, e-mail: php-list-admin <email protected>

---
Andi Gutmans <andi <email protected>>
http://www.zend.com/

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>