This article describes a Scala design pattern in which traits provide stackable modifications to underlying core classes or traits. One way to use Scala's traits is as stackable modifications. In this pattern, a trait (or class) can play one of three roles: the base, a core, or a stackable. The base trait (or abstract class) defines an abstract interface that all the cores and stackables extend, a
Recently I read following SO question : Is there any use cases for employing the Visitor Pattern in Scala? Should I use Pattern Matching in Scala every time I would have used the Visitor Pattern in Java? The link to the question with title: Visitor Pattern in Scala. The accepted answer begins with Yes, you should probably start off with pattern matching instead of the visitor pattern. See this htt
独習 Scalaz これまでいくつのプログラミング言語が羊の衣を着た Lisp に喩えられただろうか? Java は馴染み親しんだ C++ のような文法に GC を持ち込んだ。それまで他にも GC を載せた言語はあったけども、現実的に C++ の代替となりうる言語に GC が載ったことは 1996年には画期的に思われた。やがて時は経ち、人々は自分でメモリ管理をしないことに慣れていった。JavaScript と Ruby の両言語もその第一級関数 (first-class function) やブロック構文を持つことから羊の衣を着た Lisp と呼ばれたことがある。S式の同図像性がマクロに適することから Lisp系の言語はまだ面白いと思う。 近年の言語はもう少し新しい関数型言語から概念を借りるようになってきた。型推論やパターンマッチングは ML にさかのぼることができると思う。時が経てば、人
When I tell people I write code in Scala, a typical question is well, why? When it comes to writing code, most of my work is straightforward: SQL database on the backend, some architectural glue, CRUD, some exception handling, transactions handlers and an HTML or JSON front end. The tools have changed, but the problems are usually the same: you could get a website up in 5 minutes with Rails or Dro
For the last couple of weeks, we have pressed ahead and covered a lot of ground concerning some rather advanced techniques, particularly ones related to pattern matching and extractors. Time to shift down a gear and look at one of the more fundamental idiosyncrasies of Scala: the Option type. If you have participated in the Scala course at Coursera, you have already received a brief introduction t
By Alvin Alexander. Last updated: November 10, 2018 Wow, I began by writing a few Scala programming tutorials just because I like the language, and as I look here a couple of months later I now have more than sixty tutorials. As a result, I thought I'd start organizing them here in the form a Scala Programming Cookbook. Here's my current collection of Scala FAQs and recipes, in a "cookbook" format
Option を使いこなすと、関数型言語やScalaらしいプログラミングができるようになります。 どんなときに使うのか? nullの代わりに使う 関数の結果が得られない場合など (例:Map[K,V]#get(key)の返り値は Option[V]) モナド(monad)として使い、コードの流れを妨げないようにする for-comprehensionと共に使う モナドと聞いて怖じ気付く必要はありません。これらの使い方についてこれから詳しく説明していきます。 パターンマッチでOptionの値を取得 Option[A]は値が存在するか、しないかを表すクラスで、Some(a)とNoneの二種類の値があります。パターンマッチでこの二種類の値を処理するのが基本です。 val m = Map("A" -> "Apple", "B" -> "Banana") def lookup(symbol:Stri
https://github.com/scala/scala/pull/2305/files 試しに引数が200個あるメソッドや、case classくらいまでならいけた。それ以上で、例えば1000くらいになると、コンパイラが変なところで落ちるか、"ClassFormatError: Too many arguments in method ..."とかになる 2013-03-31 21:48:39 via web URL 22制限がなくなる件、微妙に反響あったから補足しておくと、2.11.0.finalがでるのはおそらく一年後くらいなので、それまでは今のままですよ…念のため 2013-04-01 21:04:55 via Twitter for iPad https://github.com/scala/scala/pull/2426 メソッドのパラメータは、最大254個までになるみたい
Releases, Offers & More Be the first to hear about our newest content, best promotions and upcoming events. Plus get 25% off your next purchase. Newsletter Sign Up Download Accounts Your email address is your account identifier. You can create a password, or just download from the links sent via email. My Orders (Resend order emails) How We're Different Hands-on instructions Solutions to real-worl
I’m excited to announce the next step in LinkedIn’s service infrastructure: the Play Framework. Play is a modern web framework that combines the performance and reliability of Java and Scala, the power of reactive programming, and the productivity of full hot reload support. We’ve been running Play 2.0 in production for several months and are now gradually rolling it out to more teams at LinkedIn.
In the first post of this seriesI showed how Scala 2.10’s new processed string syntax allow us to interpolate expression values into literal strings. We saw the s, raw and f interpolators that are provided by the Scala library. Now we will see how to write your own interpolators. The complete code for all examples in this series will be made available in the accompanying BitBucket project. Syntact
When just playing around with a new language, you might get away with simply ignoring the fact that something might go wrong. As soon you want to create anything serious, though, you can no longer run away from handling errors and exceptions in your code. The importance of how well a language supports you in doing so is often underestimated, for some reason or another. Scala, as it turns out, is p
The previous post was mostly about programming "in the small" where the primary concern is making sure the body of code in the method does what it's supposed to and doesn't do anything else. This blog post is about what to do when code doesn't work – how Scala signals failure and how to recover from it, based on some insightful discussions. First, let's define what we mean by failure. Unexpected i
これは、Typesafe 社の Director Professional Services である Heiko Seeberger 氏による「Introduction to Category Theory in Scala」の翻訳文です。誤訳、誤記などがありましたら、 日本Scalaユーザーズグループの「圏論入門 レビューのお願い」トピックに投稿していただくか、@quassia88 にご連絡ください。 もし君が僕みたいに、以前はJavaディベロッパーで、Scalaのファンになったばかりなら、君は多分遅かれ早かれ、モナドやら関手やらの、圏論の分野からやってきた謎に遭遇するだろう。そういった未知の概念は、君を、自分が恐ろしくまぬけなんじゃないか、という気分にさせることだと思う。もし君がそういう概念に既に親しんでいるなら、時間を無駄にすることはない、すぐにこのページを閉じてほしい。もしそうでな
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く