Changes for page WebObjects with Scala

Last modified by Ravi Mendis on 2011/05/10 02:10

From version 443.1
edited by John Huss
on 2010/12/03 16:45
Change comment: There is no comment for this version
To version 442.1
edited by Ravi Mendis
on 2010/12/23 06:48
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.johnthuss
1 +XWiki.rmendis
Content
... ... @@ -34,7 +34,7 @@
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.
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>>http://www.scala-ide.org]] is rather slow and still very buggy.
38 38  
39 39  = WebObjects In Scala =
40 40  
... ... @@ -190,10 +190,16 @@
190 190  
191 191  == How to Use Scala Collections with EOF ==
192 192  
193 -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:
194 194  
195 -Then you can 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.
195 +{{code value="java"}}
196 196  
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 +
197 197  == How to Add Scala to a WO Project ==
198 198  
199 199  {{include value="WOL:Adding Scala Support to a WOLips Project"}}{{/include}}