Return 'this' proposal
develop4lasu at gmail.com
Sun Mar 15 15:49:51 PDT 2009
2009/3/15 Reinier Zwitserloot <reinier at zwitserloot.com>
> the interesting/complicated part of a return this proposal is the actual
> return type (in the classfile) of the method. Should it be 'void'? Should it
> be the type of the class? But, in that case, every method that has a return
> type of 'this' needs to be dummy-overridden in every subclass just to set
> the return type correctly.
> You've covered none of this in your proposal.
> --Reinier Zwitserloot
Actual return type is current object type, but it could be extracted to
I know that overriding is required, truly this solution is not refactor
friendly, but interpret it is much more easy than 'This' type.
What more 'This' as type would be allowed to some "special" generics only,
what could prevent programmers from using it.
So notice that:
- When Generic change and will be not able to handle This type than model
will need to be changed.
When need change void to this, we need only change returned type in all
This two proposals are on completely different levels:
'This': Generics & inheritance & return type & return type interaction
'this': return type
Hope you get what do I mean.
Pozdrowionka. / Regards.
Lasu aka Marek Kozieł
More information about the coin-dev