Tom
I think your work on interfacing CAL with Java via the use of Javassist
is pretty cool, with the dynamic generation of classes and methods to
hook into the metaprogramming facilities of CAL. The use of Java
annotations to effectively import a CAL function as a Java method
without having to write glue code, and the ability to tunnel extra state
in and out of a function call (via 'in' and 'out' annotation fields) do
look pretty handy.
Reading your blog articles, I started thinking that perhaps Andrew's
work on Embedded CAL
(http://groups.google.com/group/cal_language/web/embedded-cal) can be
used in tandem with your approach. For instance, the word counter
example
(http://diversions.nfshost.com/blog/2007/09/23/javassist-and-annotations
-for-interfacing-java-to-cal/) could be expressed as:
public String addWord(String word) {
List<?> result = (List<?>)
[[ TDavies.WordCount.addWord word wordCount ]];
wordCount = ((Integer)result.get(1)).intValue();
return (String)result.get(0);
}
...where [[...]] indicates an embedded editor - the 'wordCount' instance
variable and the 'word' parameter would be visible to the CAL code in
the embedded editor.
Also, the proposed standalone library JAR support provides yet another
way to achieve a similar result. For example, it could generate a JAR
containing a class such as:
public final class WordCountAPI {
public static java.util.List addWord(
String word, int count, ExecutionContext executionContext) {...}
}
...and then it would be a matter of calling the method on WordCountAPI
directly.
It looks like you're working on some neat stuff with CAL (with the
Tapestry integration and doing CRUD on CAL algebraic types). I think
many of us CAL users are quite excited about it and would look forward
to your future postings!
Cheers,
Joseph