Zeev/Andi,
Right now you can "replace" the object returned by "new Foo" by
assigning $this in the Foo constructor, like this:
class Foo extends PEAR
{
function Foo()
{
if (!init_foo_resource()) {
$this = $this->raiseError("could not initialize foo resource");
return;
}
}
}
This is a cool feature, and doing what the example above does would be
very nice, but PEAR coders still have the decency not to. The
alternative is to have dumb constructors that don't do anything that
may go wrong, and use a second method call for the rest. That's twice
the number of lines!
Anyway, I'd like to see "$this assignment in constructor":
1. dismissed as a bug
2. documented as a feature, or
3. subject to discussion resulting in (1) or (2)
- Stig
--
Stig Sæther Bakken <[EMAIL PROTECTED]>
Fast Search & Transfer ASA, Trondheim, Norway
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]