Implicit 'this' return for void methods

Steven Schlansker stevenschlansker at
Thu Mar 27 19:22:13 UTC 2014

On Mar 27, 2014, at 9:35 AM, Jochen Theodorou <blackdrag at> wrote:

> Am 26.03.2014 16:51, schrieb Guy Steele:
> [...]
>> I am wholeheartedly in favor of allowing “chaining” of dotted expressions such as
>>    CharBuffer.allocate(26).position(2).put("C").position(25).put("Z”)
> this also shows a potential point of critic this proposal will have to find arguments against. This style highly encourages mutation of the object, which is not very functional. Since java8 java tries to be more functional, thus this idea would be totally against this new line.
> I leave it to you guys if this is even a valid argument ;)

It would be much easier to convince people to do less mutation if the language had support for the Builder pattern or freezing objects.  Currently working with nontrivial immutable objects quickly leads to a lot of boilerplate code that requires frustrating maintenance every time the object definition changes.

Adding both the implicit ‘this’ proposal as well as some syntax enhancements for immutable objects would strengthen the Java language quite a bit, in my opinion :)

More information about the core-libs-dev mailing list