Hi Carsten,
I'll have a look at your patches tomorrow or thursrday. Thanks!
Ok thanks.
In general, I think we have to change the scale support - I spoke with
some Scala guys recently and they thought that it is possible to
really have a scala script (instead of having a scala class atm).
Up to Scala 2.7.x there is no such thing as 'real scripts'. The script
interpreter which comes with the distribution is just a compiler on a
background thread. To achieve the scripting feeling, this interpreter
embeds the script into a class preamble before sending it to the
compiler. The problem is then that line numbers are not preserved this way.
My current approach requires very little ceremony (Java programmers
wouldn't even note ;-) ) For details see my Jazoon preso [1].
it would be possible to mix scala expressions with tags like in jsp
etc.
This is already possible leveraging Scala's support for xml literals
[1]. A simple hello world programm looks basically like this in Scala:
println {
<html>
<h1>{ "Hello " + currentNode("title") }</h1>
Today is { Calendar.getInstance.getTime } <br />
My path is { currentNode.path }
{ Tree(currentNode).render }
</html>
}
My sample apps contains more code. But this is only support code making
JCR and Sling more convenient to use from Scala. Eventually this code
should go into a separate support library.
But so far, noone wanted to help out :(
Get me in touch if you find someone ;-)
Michael
[1] http://people.apache.org/~mduerig/scala4sling/scala4sling.pdf
Regards
Carsten
On Tue, Dec 1, 2009 at 5:12 PM, Michael Dürig <[email protected]> wrote:
where help would be appreciated:
https://issues.apache.org/jira/browse/SLING-1215
I'd like to add some examples for Scala scripting to Sling.
Michael