Saturday 15 May 2010

Hello Scala World



Simple and concise. The thing to notice here is the keyword object. Scala has the built in concept of a Singleton, which simplifies design. All the static members are to be placed in the object companion, which replaces enums and acts as a default factory for your object. Brilliant!


To do enums, we have several alternatives:



or



Which can be used extensively with case classes.

Thanks to Carte Cole's syntax highlighting tutorial using SyntaxHighlighter

No comments:

Post a Comment