O'Reilly logo

Programming Scala by Alex Payne, Dean Wampler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Code Examples

This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “Programming Scala by Dean Wampler and Alex Payne. Copyright 2009 Dean Wampler and Alex Payne, 978-0-596-15595-7.”

If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .

Getting the Code Examples

You can download the code examples from http://examples.oreilly.com/9780596155964/. Unzip the files to a convenient location. See the README.txt file in the distribution for instructions on building and using the examples.

Some of the example files can be run as scripts using the scala command. Others must be compiled into class files. Some files contain deliberate errors and won’t compile. We have adopted a file naming convention to indicate each of these cases, although as you learn Scala it should become obvious from the contents of the files, in most cases:

*-script.scala

Files that end in -script.scala can be run on a command line using scala, e.g., scala foo-script.scala. You can also start scala in the interpreter mode (when you don’t specify a script file) and load any script file in the interpreter using the :load filename command.

*-wont-compile.scala

Files that end in -wont-compile.scala contain deliberate errors that will cause them to fail to compile. We use this naming convention, along with one or more embedded comments about the errors, so it will be clear that they are invalid. Also, these files are skipped by the build process for the examples.

sake.scala

Files named sake.scala are used by our build tool, called sake. The README.txt file describes this tool.

*.scala

All other Scala files must be compiled using scalac. In the distribution, they are used either by other compiled or script files, such as tests, not all of which are listed in this book.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required