古い howm-mode と emacs 24 で inhibit-first-line-modes-regexps が無いといわれるので
(defvaralias 'inhibit-first-line-modes-regexps 'inhibit-local-variables-regexps)
を追加して暫定対処。
ちゃんとしたパッチがあるのであとでやる http://howm.sourceforge.jp/index-j.html
続々「Scala スケーラブルプログラミング 第2版」で気づいたこと
List 操作の代表的なメソッドが紹介されているが、remove と sort は Scala 2.10.0 だと無い。
代わりに filterNot と sortWith を使う。
https://github.com/yewton/scala_ex/blob/master/03_next_steps_in_scala/list_functions.scala
Unsupported version number [51.0] for class format
http://yusukezzz.net/blog/archives/2149
を参考に、ホイホイと最新の JDK とか入れていざコンパイルしてみると以下の様なエラーが発生するかもしれない。
[trace] Stack trace suppressed: run last HelloScala/android:proguard for the full output. [error] (HelloScala/android:proguard) java.io.IOException: Can't read [C:\helloscala\target\scala-2.9.2\classes] (Can't process class [jp/gr/java_conf/yewton/helloscala/R$attr.class] (Unsupported version number [51.0] for class format)) [error] Total time: 10 s, completed 2013/03/07 22:20:34
Android SDK にバンドルされている ProGuard が、JDK 1.7 以降に対応してないのが原因らしい。
JDK 1.6 入れて、~/.sbt/global.sbt あたりに
javaHome := Some(file("C:\\Program Files\\Java\\jdk1.6.0_43"))
Mac OS X で Java の file.encoding が SJIS になってて困る
Mac で UTF-8 で Scala のコードを書いてて、日本語を書いちゃうと、
java.nio.charset.UnmappableCharacterException
が発生したりします。
utf 8 - Printing Unicode from Scala interpreter - Stack Overflowにあるように、JAVA_OPTS="-Dfile.encoding=UTF-8" を環境変数に設定しておけばよいようです。
僕は Emacs で scala-run-scala で起動した REPL か eshell で実行しているので、両方でこの設定が生きるように以下のように .emacs に書いてます。
(custom-set-variables '(scala-interpreter "scala -Dfile.encoding=UTF-8") ) (setenv "JAVA_OPTS" "-Dfile.encoding=UTF-8")
続「Scala スケーラブルプログラミング 第2版」で気づいたことなど
Scala 2.10.0 では、暗黙の型変換を何もせずに定義すると以下の warning が発生します。
warning: implicit conversion method intToRational should be enabled by making the implicit value language.implicitConversions visible. This can be achieved by adding the import clause 'import scala.language.implicitConversions' or by setting the compiler option -language:implicitConversions. See the Scala docs for value scala.language.implicitConversions for a discussion why the feature should be explicitly enabled.
ということで該当する Scala docsを見てみると、なぜこのような Warning を発生させているかが書いてあります。
Implicit conversions are known to cause many pitfalls if over-used. And there is a tendency to over-use them because they look very powerful and their effects seem to be easy to understand. Also, in most situations using implicit parameters leads to a better design than implicit conversions.
つまり、
- 便利だけど多用すると罠が多い
- 便利であるが故に多用しやすい
- implicit parameter を使うほうがよいデザインになる場合が多い
ということのようです。
「Scala スケーラブルプログラミング 第2版」で気づいた間違いなど
- p.088 Application が Appliation となっている部分がある
- extends Application は 2.9.0 から @deprecated