Changes for page WebObjects with Scala
Last modified by Ravi Mendis on 2011/05/10 02:10
From version 438.1
edited by John Huss
on 2010/12/03 16:40
on 2010/12/03 16:40
Change comment:
There is no comment for this version
To version 440.1
edited by Ravi Mendis
on 2010/12/23 06:45
on 2010/12/23 06:45
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. johnthuss1 +XWiki.rmendis - Content
-
... ... @@ -34,6 +34,8 @@ 34 34 Yes. It is very simple. 35 35 Scala compiles to java bytecode. Hence using it with WebObjects is fairly straightforward. 36 36 37 +However, tool support is a weak point. You should use Eclipse 3.6 with bundle-less WO builds. If your Application class is in Scala then you will have to create an Eclipse launch configuration manually. One weird thing is that once you add the Scala nature to a WO project WOD completion will stop working - this is unfortunate. Also the Scala plugin is rather slow and still very buggy. 38 + 37 37 = WebObjects In Scala = 38 38 39 39 The following highlights some of the differences between Java and Scala in WebObjects: ... ... @@ -188,10 +188,16 @@ 188 188 189 189 == How to Use Scala Collections with EOF == 190 190 191 -To use the Scala Collections API with an NSArray or NSDictionary you simply need to add an import: import scala.collection.JavaConversions.193 +To use the Scala Collections API with an NSArray or NSDictionary you simply need to add an import: 192 192 193 - Then youcan access the typical Scala collection methods directlyon NSArray. This employs a feature of Scala known as implicit conversions toautomagically cast a NSArray (a Java Iterable) into a Scala Iterable while leaving the actual object unchanged. Alternatively, you could generate an actual new scala.List instance by calling myNSArray.toList.195 +{{code value="java"}} 194 194 197 +import scala.collection.JavaConversions._ 198 + 199 +{{/code}} 200 + 201 +After that, you may access the typical Scala collection methods directly on NSArray. This employs a feature of Scala known as implicit conversions to automagically cast a NSArray (a Java Iterable) into a Scala Iterable while leaving the actual object unchanged. Alternatively, you could generate an actual new scala.List instance by calling myNSArray.toList. 202 + 195 195 == How to Add Scala to a WO Project == 196 196 197 197 {{include value="WOL:Adding Scala Support to a WOLips Project"}}{{/include}}