Changes for page WebObjects with Scala
Last modified by Ravi Mendis on 2011/05/10 02:10
From version 466.1
edited by Ravi Mendis
on 2010/12/24 00:37
on 2010/12/24 00:37
Change comment:
There is no comment for this version
To version 469.1
edited by Ravi Mendis
on 2010/12/24 00:43
on 2010/12/24 00:43
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -44,7 +44,7 @@ 44 44 Scala doesn't have static variables or methods. Instead Scala employs the [[Singleton Pattern>>http://en.wikipedia.org/wiki/Singleton_pattern]] which is built into the language and is **thread-safe**: a class can have a //Companion Object// that will allow you to achieve something equivalent to static variables - but better. 45 45 46 46 You don't have to worry about synchronizing access to shared mutable fields in a concurrent application. 47 -This is not however true for mu table ##val## e.g:##NSMutableArray##, ##scala.collection.mutable.ListBuffer##whichyou will have to synchronizethe adding to or removing from.47 +(This is not however true when for example you have a ##val## declared as a ##NSMutableArray##. You will still have to synchronize when adding to or removing from this mutable field). 48 48 49 49 The following is an example of the use of a //Companion Object// for Talent in Scala instead of Talent static fields in Java. 50 50 ... ... @@ -198,16 +198,10 @@ 198 198 199 199 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. 200 200 201 -== How to Add Scala to a WO Project == 201 +== How to Add Scala to a WO Project (in Eclipse) == 202 202 203 203 {{include value="WOL:Adding Scala Support to a WOLips Project"}}{{/include}} 204 204 205 -{{note}} 206 - 207 -This is for Eclipse/WOLips IDE 208 - 209 -{{/note}} 210 - 211 211 == WO Scala Example == 212 212 213 213 The following example is an almost 100% Scala WO app. In reality it is a mixed Java/Scala app: