# HG changeset patch # User Christian Urban # Date 1409184251 -3600 # Node ID 2c512713f08a16d61466073c07fdbef9cba800a7 # Parent 47bcc2178f4ed2424b5b47d20b91ce56e1856c23 updated diff -r 47bcc2178f4e -r 2c512713f08a handouts/scala-ho.pdf Binary file handouts/scala-ho.pdf has changed diff -r 47bcc2178f4e -r 2c512713f08a handouts/scala-ho.tex --- a/handouts/scala-ho.tex Wed Aug 27 16:40:23 2014 +0100 +++ b/handouts/scala-ho.tex Thu Aug 28 01:04:11 2014 +0100 @@ -19,17 +19,18 @@ Scala is a programming language that combines functional and object-oriented programming-styles, and has received in the -last five years quite a bit of attention. One reason for this -attention is that, like the Java programming language, Scala -compiles to the Java Virtual Machine (JVM) and therefore can -run under MacOSX, Linux and Windows.\footnote{There are also -experimental backends for Android and JavaScript.} Unlike -Java, however, Scala often allows programmers to write very -concise and elegant code. Some therefore say Scala is the much -better Java. The Guardian, Twitter, Coursera, LinkedIn to name -a few either rely entirely in their infrastructures on Scala, -or some parts of there infrastructure uses it. If you want to -try it out yourself, the Scala compiler can be downloaded from +last five years or so quite a bit of attention. One reason for +this attention is that, like the Java programming language, +Scala compiles to the Java Virtual Machine (JVM) and therefore +Scala programs can run under MacOSX, Linux and +Windows.\footnote{There are also experimental backends for +Android and JavaScript.} Unlike Java, however, Scala often +allows programmers to write very concise and elegant code. +Some therefore say Scala is the much better Java. Some +companies (The Guardian, Twitter, Coursera, LinkedIn to name a +few) either use Scala excusively in production code, or some +part of it are written in Scala. If you want to try out Scala +yourself, the Scala compiler can be downloaded from \begin{quote} \url{http://www.scala-lang.org} @@ -54,8 +55,8 @@ Read-Eval-Print-Loop) with which you can run and test small code-snippets without the need of the compiler. This helps a lot with interactively developing programs. Once you installed -Scala correctly, you can start the interpreter by typing - +Scala correctly, you can start the interpreter by typing on +the command line: \begin{quote} \begin{alltt} @@ -828,12 +829,11 @@ def ~ (r: Rexp) = SEQ(s, r) def ~ (r: String) = SEQ(s, r) def % = STAR(s) - } \end{lstlisting} \end{quote} -\noindent This might seem a bit complicated, but its effect is +\noindent This might seem a bit overly complicated, but its effect is that I can now write regular expressions such as $ab + ac$ even simpler as @@ -898,17 +898,23 @@ \subsection*{More Info} -There is much more to Scala, then I can possibly describe -here. There are a number of free books about Scala and of -course lots of help online. +There is much more to Scala than I can possibly describe in +this document. Fortunately there are a number of free books +about Scala and of course lots of help online. For example + +\begin{itemize} +\item \url{http://www.scala-lang.org/docu/files/ScalaByExample.pdf} +\item \url{http://www.scala-lang.org/docu/files/ScalaTutorial.pdf} +\end{itemize} -While I am quite enthusiastic about Scala, I am happy to admit -that it has more than a fair share of faults. The problem of -having to give an explicit type to {\tt toSet}, but not {\tt -toList} is one of them. There are also many ``deep'' things -about types in Scala, which even to me seasoned functional -programmer are puzzling. While implicits are great, they -can also be a source of great head-aches, for example +While I am quite enthusiastic about Scala, I am also happy to +admit that it has more than its fair share of faults. The +problem seen earlier of having to give an explicit type to +{\tt toSet}, but not {\tt toList} is one of them. There are +also many ``deep'' ideas about types in Scala, which even to +me as seasoned functional programmer are puzzling. Whilst +implicits are great, they can also be a source of great +headaches, for example consider the code: \begin{quote} \begin{alltt} @@ -917,22 +923,25 @@ \end{alltt} \end{quote} -\noindent This should raise a typing-error, but it does not. +\noindent Rather than returning {\tt false}, this code should +throw a typing-error. There are also many limitations Scala +inherited from the JVM that can be really annoying. For +example a fixed stack size. -While Scala has been a success in several high-profile -companies, there is also a company, Yammer, which first used -Scala in their production code but then moved away from it. -According to Wikipedia, they did not like steep learning curve -of Scala and also that new versions of Scala often introduced -incompatibilities. +Even if Scala has been a success in several high-profile +companies, there is also a company (Yammer) that first used +Scala in their production code, but then moved away from it. +Allegedly they did not like the steep learning curve of Scala +and also that new versions of Scala often introduced +incompatibilities in old code. -So all in all, Scala might not be a great teaching -language, but I hope this is mitigated by the fact that I -never require from you to write any Scala code. You only -need to be able to read it. In the coursework you can use -any programming language you like. If you want to use -Scala for this, be my guest; if you do not, stick with the -language you are most familiar with. +So all in all, Scala might not be a great teaching language, +but I hope this is mitigated by the fact that I never require +you to write any Scala code. You only need to be able to read +it. In the coursework you can use any programming language you +like. If you want to use Scala for this, then be my guest; if +you do not want, stick with the language you are most familiar +with. \end{document}