Re: Java Syntax Extensions
James Willans wrote:
We have put together a document which outlines a proposal for adding
mechanisms to the Java language which allow it to be arbitrarily
extended, such mechanisms would support Language Oriented Programming
It's a well written document and very accessible to someone who is not
familiar with DSLs. However, I'm rather against anything that adds too
much complexity to the base language. Your examples, brief as they are,
are pretty complex and rather more difficult to read than they really
need to be. I'm not sure I'd like to actually puzzle out new grammars
and new grammar-specifications every time I open a Java source file. I
can't imagine what trying to specify a full grammar would be like. A
horrid mess, I'm sure.
Rather, I don't think you've given enough thought to frameworks and
libraries, as your paper calls them. Look at languages like Scala and
Jython. They are full independent languages that use the JVM. If you
need a DSL, use a DSL. Don't use Java. Then if you need bindings to
access your DSL functions in Java, or to access the Java API from your
new language, well that's I think that's where some opportunities are
for research.
C++ provides the best counter example why we should not accept your
proposal. C++ is a baroque mess. It tries to be all things to all
people and fails by being too complex to use for a full lifecycle. Java
succeeds by being simple enough to maintain while having enough tools to
get the job done. Let's keep that feature. It's Java's primary strength.