Scala for scripting
by michid
- 3,247 views
Its conciseness, versatility and DSL capabilities makes Scala desirable for scripting. In this report we show how we implemented a JSR223 compliant script engine for Scala which runs inside OSGi ...
Its conciseness, versatility and DSL capabilities makes Scala desirable for scripting. In this report we show how we implemented a JSR223 compliant script engine for Scala which runs inside OSGi environments.
While the Scala compiler needs a class path to load class files, OSGi only provides class loaders. To overcome this we implemented a file system abstraction on top of OSGi bundles effectively providing a class path. Furthermore, JSR223's dynamic approach for passing arguments does not play well with Scala's static types. We need to make all types of arguments visible to scripts. Our implementation generates a preamble of adequate implicit conversions which allows scripts to use statically typed variables in a manner resembling dynamic types. Finally performance constraints require caching of pre-compiled scripts.
Apache Sling, an OSGi based web application framework with a scriptable application layer, uses our implementation for type safe templating via Scala's XML support.
Accessibility
Categories
Upload Details
Uploaded via SlideShare as Apple Keynote
Usage Rights
© All Rights Reserved
Statistics
- Likes
- 1
- Downloads
- 33
- Comments
- 0
- Embed Views
- Views on SlideShare
- 3,211
- Total Views
- 3,247
- Ambiguity issues: robuster when using a provider class as source for implicit conversion for each binding
- Impedance mismatch: JSR-223 provides support for dynamically typed languages, Scala is statically typed
- Impedance mismatch: OSGi is a runtime environment, scalac a compile time utility