Foreword

Puzzles are fun. I still remember the first time I came across the "puzzler" format for a programming language. It was when Neal Gafter presented the latest Java puzzlers to me that he and Josh Bloch had collected. At the time, Neal was maintaining the javac compiler that I had written. The puzzles were hard! I guessed wrong quite a few times, to Neal's delight.

I am pleased that there is now a book that continues the puzzler tradition in Scala. The book presents thirty-six puzzles arising from surprising effects, interactions of features, or consequences of encodings that are not obvious at the surface. The puzzles were collected over some years with extensive input from the Scala community.

Andrew and Nermin distill each puzzler to its essence and make it easily understandable. After having had the pleasure to try to pick the right solution among a set of choices, you are then led to the why: What are the reasons for the perhaps surprising solution? It is here that the book really shines, because it provides clear explanations of the underlying principles that lead to the observed program behavior. What I liked particularly about the book is that the explanations often lead to new insights. They tell you not just anecdotes of surprising behavior but something deep about how Scala is put together. In that way, the puzzles will help you develop a more profound understanding of the language.

I hope you have as much fun reading the book and trying to solve the puzzles as I had. And, if you must know, yes, there were some puzzles I could not solve.

Martin Odersky
Somewhere over the Atlantic
May 26, 2014

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.227.82