On 17/05/2016 13:48, Jesse Schalken wrote:

On Tue, May 17, 2016 at 9:14 PM, Rowan Collins <rowan.coll...@gmail.com
<mailto:rowan.coll...@gmail.com>> wrote:

    To reiterate my comments from earlier in the thread, I think the
    "$id = $id" looks really weird here, and spoils the step-by-step
    layout - and, in this case, the symmetry.


We have the same thing already when chaining methods on value/immutable
objects, like with PSR-7:

    $message = $message
        ->withHeader('foo', 'bar')
        ->withAddedHeader('foo', 'baz');


So depending on often that pattern is used, many are probably already
used to seeing "$var = $var   ....", myself included.

A fair point. Although you could of course combine OO chaining with syntax chaining:

$message
    ->withHeader('foo', 'bar')
    ->withAddedHeader('foo', 'baz')
    |=> $message;

The longer the chain, the more awkward it is to rewind to the beginning to find where the result is being used / saved.

See also my earlier post where I went into why a tail assignment would improve the ability to debug pipes, and mix them with non-piped code: http://marc.info/?l=php-internals&m=146205812523026&w=2

Again, all of this applies to mixing with existing OO pipes like PSR-7.

Regards,
--
Rowan Collins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to