@Alexandru:
>  Worth reading:
Ah shoot, my search-fu failed me (it's not listed on the RFC page, and
I suppose I was not using
the right search terms). I'm glad to find out this rfc previously
existed, and in that case, I
guess I'd like to revive that discussion. :)

@Luigi:
> The part that I do not like is the implicit return: it may confuse developers 
> and static analysis
> tools.
I understand the implicit return may be somewhat confusing, but one of
the secondary driving
factors, aside from a much clearer API signature (without requiring a
docblock comment), and engine
enforced object safety, was the benefit of reduced "boilerplate" code.
However, I suppose I can
accept that this may not be possible, but I would like to discuss it
as a potential option. However,
I disagree with you about the static analysis tools.

> Is it possible to replace "$this" with "this"? Cleaner and coherent with 
> "self".
I actually thought about this a bit before posting, and I came to the
same conclusion as Nicolas,
i.e.:
/**
 * @return $this
 */

To quote Nicolas:
> About the syntax, I think the one proposed in the RFC is crystal clear. I've 
> been used to seeing
> the "$" symbol [snip]
More on this below.


@previous commenters on the old thread

Andreas Heigl said:
> If we allow a $this [snip] as a returntype to clarify that it has to be the 
> same instance that is
> returned, I would also either expect that the returntype 'self' does 
> explicitly not allow the
> same instance to be returned. As that would be a huge BC break [snip] we 
> should implement a
> returntype "!$this" to explicitly state that the contract here returns not 
> the current instance
> but a new one.
Strongly disagree. This would be too much of a BC, and I don't really
see the benefit, even allowing
for a "!$this"-style returntype. I'm not opposed to a separate RFC or
discussion regarding this, but
I don't feel it's appropriate here.


Sebastian Bergmann said:
> [snip] please not "$this" as the name for a type.
> Off the top of my head, I think that "same" could make sense.
My primary vote would still be for "$this" as explained above, but I
could potentially be persuaded
to switch to "this" or "same" as alternatives if the dollar-sign is
too much of a hang-up.


Regards,
radar3301

Reply via email to