>> I also think that:
>> $foo = (new bar())->someSetter();
>
> someSetter() could return $this, although unlikely. The result of the line
> above would be that the bar object is garbage collected after being created
> & method someSetter() invoked. To keep it one would have to do:
In very rare occassions I don't need to keep the object and I am fine
with garbage collection.
>From garbage collection in PHP I know less, but isnt it so that:
function blub() {
$foo = new O();
// do long other stuff
}
gc's $foo only after the method is finished?
function blub() {
new O()->doSomething();
}
would enable to collect this object before method ends. I am not sure
if that works with php, but it might.
> this could be simplified to:
>
> $employees->findEmployee('John Smith')->increaseSalary(1000);
>
> This is the sort of reason why chaining is useful. It is also, IMHO, quite
> readable.
That is exactly what I would love to see in PHP. Notation is also very
similar to java notation.
Cheers
Christian
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php