Re: AspectJ: solution to Java's repetitiveness?
I've only touched AspectJ a bit, some code I inherited at work. Basically a
regular expression is used to insert bytecode - that's the weaving. You're not
weaving in methods, you're weaving in lines of code. You do have access to
The weaving I saw -- possibly Spring, since that's one framework I
looked at a long while ago -- wove directly in byte code. In other
words, directly on the .class file, not in source code. (Early versions
of Aspect Oriented Programming I think used source code instead of byte
I thought it used annotations instead of the "regular expression" bit,
but I could be mistaken.
Anyway, with access to a this pointer, it seems like code weaving could
solve at least some of the OP's issues. I think it would work for
toString(), it might work for Clonable. Add a weave for Copyable and
DeepCopyable and you might have it, which weave into a clone() method,
and you might have it.
Java gets really close to full support for most of the OP's concerns.
Its toString() works fine, just not how the OP wanted. clone() and
serialization (with XML) are there, they just need a bit of tweaking.
I don't see the need, but if you really must drive a code base to the
minimum number of lines, and also support a lot of wordy, tedious
interfaces on every object, code weaving might get you there.
OTOH code weaving and GWT might throw the hell up. Weaving on byte codes
at least I'm sure would not be supported when your "byte codes" are