PROPOSAL: Return 'this' (original) (raw)
Artur Biesiadowski abies at adres.pl
Wed Mar 25 15:42:43 PDT 2009
- Previous message: PROPOSAL: Return 'this'
- Next message: PROPOSAL: Return 'this'
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I think that you are putting two separate proposals here:
Having 'silent' exit from method and parameterless return equivalent to 'return this' if method return type is non-void
Introducing kind of auto-covariant return type, which resolves to given class and accepts only 'this' returns
I don't particularly like point 1 - it will save some typing, but has certain kind of magic I would prefer to keep out of java. Point 2 is nice for builders, unfortunately it cannot be used for anything else other than chain calls - for example, clone method could not be written using this functionality (as you could write return new A() in A class and not redefine it in B).
I don't understand Compatibility forward: Only jars. I don't see a way to have such code verified in existing versions of java.
Regards, Artur Biesiadowski
- Previous message: PROPOSAL: Return 'this'
- Next message: PROPOSAL: Return 'this'
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]