Since Java still gets managers all hot and bothered, I decided that I would dive into yet another programming language (when will I ever learn?). Playing with Swing, I discovered that mutators have void return types. That seems like a waste. Why not return the object? Since chained mutators seem to be something that no one can agree on, I've just decided to come down on the "I likes 'em" side of the fence. Which leads me to my problem.
You cannot overload Java methods by changing the return type.
After that serious let down, I realized I would have to change method names to get what I want. Now, instead of this:
JPanel pane = new JPanel();
I can do this:
ChainedJPanel pane = new ChainedJPanel();
I have a feeling that this will one of my less popular hacks, but with better exception handling and polymorphic dispatch based on method signatures, it seems that Java is a better fit for this idiom than Perl.
If you can deal with how painfully slow JavaJunkies is, you can read about my attempts here.