PROPOSAL: Return 'this'

Tom Hawtin Thomas.Hawtin at Sun.COM
Thu Mar 26 15:29:31 PDT 2009


Stefan Schulz wrote:

> String str = new StringBuilder() do {
>    append(person.getName());
>    if (person.isMarried()) {
>      append("(married)");
>    }
> }.toString();

I think what disturbs me about these sort of 'with' extensions, is 
method resolution. How do we decide which object and method 'append' 
applies to. That area of the language is already broken by complexity.

I suspect that a reasonably complete solution in this area would not fit 
the definition of small, and would be the subject of much conflicting 
opinion. :(

Tom Hawtin



More information about the coin-dev mailing list