CAL/Web framework integration

0 views
Skip to first unread message

Tom Davies

unread,
Oct 3, 2007, 10:06:36 PM10/3/07
to CAL Language Discussion
I've written up some more of my experiments interfacing CAL to
Tapestry: http://diversions.nfshost.com/blog/2007/10/03/cal-and-tapestry-5-part-2-algebraic-types-and-forms/

Tom

Joseph Wong

unread,
Oct 9, 2007, 6:10:28 PM10/9/07
to cal_la...@googlegroups.com
Hi 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

Reply all
Reply to author
Forward
0 new messages