Hi Michael,

The main issues from the Sling side are ATM:
>
> - Dependency on Sling. Mainly because the compiler needs to output the
> class files into the repository.
>
Isn't compiling to  the data-file area of the osgi bundle an option in
sling?

- Scripts need to follow Sling specific cermony [2]. I'm not really happy
> with this for several reasons. The LineDeductingReporter could come in handy
> here.
>
Could you give a norrower point to the things a cript-engine must do for
working with sling? I assume sling can work with a standard javax.script
complaint engine. We've implemented ScalaServerPages in a separate package
just adding a few more lines before passing it as script to the script
engine.

- The variable bindings mechanism needs to be improved. I see there is some
> effort in clerezza regarding this.
>
It's very raw at the moment but it should be possible to have an object
appearing to be of all the visible types on the scala side.

Reto

>
> Michael
>
>
> [1] http://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/scala/
> [2] 
> http://people.apache.org/~mduerig/scala4sling/scala4sling.pdf<http://people.apache.org/%7Emduerig/scala4sling/scala4sling.pdf>
>
>
> Reto Bachmann-Gmuer wrote:
>
>> the clerezza project (which has been accepted for apache incubation last
>> week) contains some scala support as well [1]. It's based on sling-code
>> but
>> extended to provide a ScriptEngineFactory. It takes to declare the bound
>> variables using a type visible to the "interpreted" scala code in the OSGi
>> runtime.
>>
>> This ScriptEngine is used for standard scripting but also for
>> "ScalaServerPages", here Scala is used with a DSL to render a
>> response-resource (a node in an RDF graph). The following is an example of
>> a
>> ScalaServerPage:
>>
>> def um(s: Any) = new UriRef("http://clerezza.org/2009/05/usermanager#"+s)
>> def perm(s: Any) = new UriRef("http://clerezza.org/2008/10/permission#
>> "+s)
>> <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
>>    <head>
>>        <title>Permissions for user {res/um("user")/FOAF.name}</title>
>>    </head>
>>    <body>
>>    {for (permission <- res/um("permission")) yield
>>        <div id="permission">
>>            {permission/perm("javaPermissionEntry")*}
>>        </div>
>>    }
>>    </body>
>>
>> </html>
>>
>> While ScalaServerPages would probably be hard to use withing Sling I think
>> it would be good to pool the efforts for having a single
>> javax.script.ScriptEngineFactory.
>>
>> From the clerezza-code the following wqould have to be done:
>> - refactor ScalaInterpreter (taken from Sling) for synchronization issues
>> - enhance algorithm to find best runtime-visible interface of a bound
>> object
>> (and possibly use implicit conversions to cast the object from one
>> implemented interface to the other)
>>
>>
>> Cheers,
>>
>> 1. The code should be moved to the invubator svn very soon, currently its
>> here: http://scm.trialox.org/main/org.clerezza.scala/
>>
>>
>> On Tue, Dec 1, 2009 at 7:32 PM, Carsten Ziegeler <[email protected]
>> >wrote:
>>
>>  Michael Dürig wrote:
>>>
>>>> [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>
>>>>>>  }
>>>>>>
>>>>>>  Yes, and this looks fine except the println statement surrounding
>>>>> everything. Maybe if we can get rid of that one we are already one step
>>>>> further?
>>>>>
>>>> Well that shouldn't be too difficult to do I think. It was actually my
>>>> decision to *explicitly* println. I can try to come up with another
>>>> patch later.
>>>>
>>>>  Cool!
>>>
>>> Carsten
>>> --
>>> Carsten Ziegeler
>>> [email protected]
>>>
>>>
>>
>

Reply via email to