勉強会@東北
• Scala勉強会@東北
–Changes and Improvements on Scala 2.8
• http://sites.google.com/site/scalatohoku/changes-
and-improvements-on-scala-2-8
• 抜粋
• Redesigned collection libraries
• Named and default arguments
• Support for continuations
• ( )
Type specialization(@specialized annotation)
• @tailrec and @switch
• 山中さん素晴らしいっっ
31.
新機能-Scala東北ML
• scala.reflect.Manifest
– http://groups.google.co.jp/group/scala--
tohoku/browse_thread/thread/2858a1b7807929c5?hl
=ja
• scala.util.control.Breaks
– http://groups.google.co.jp/group/scala--
tohoku/browse_thread/thread/f4475f1d0da0181f?hl=j
a
• パターンマッチの最適化のチェック(@tailrec)
– http://groups.google.co.jp/group/scala--
tohoku/browse_thread/thread/ac3da34f805ee6c2?hl=
ja
32.
新機能-Scala東北ML
• 自己末尾再帰関数呼び出しの最適化
– http://groups.google.co.jp/group/scala--
tohoku/browse_thread/thread/6af4efd83a8e0
328?hl=ja
• case class - copy メソッド
– http://groups.google.co.jp/group/scala--
tohoku/browse_thread/thread/72211849f32aa
5e4?hl=ja
言語仕様の一次情報
• Scala Reference
– sbaz install scala-documentation
• The Scala Language Specification Version 2.8
– ChangeLogより抜粋
37.
• Changes in Version 2.8.0
– Trailing commas
• Trailing commas in expression, argument, type or pattern sequences are no longer
supported.
• Changes in Version 2.8 (under development)
– Changed visibility rules for nested packages (where done?)
– Changed visibility rules in §2 so that packages are no longer treated specially.
– Added section §3.5.3 on weak conformance. Relaxed type rules for
conditionals,match expressions, try expressions to compute their result type
using least upper bound wrt weak conformance. Relaxed type rule for local type
inference so that argument types need only weekly conformto inferred formal
parameter types. Added section on numeric widening in §6.25 to support weak
conformance.
– Tightened rules to avpod (avoidのtypo?) accidential overrides in §5.1.4.
– Removed class literals.
– Added section §7.4 on context bounds.
– Clarified differences between isInstanceOf and pattern matches (§12.1).
– Allowed implicit modifier on function literals with a single parameter (§6.23).
の確認
Change Logの確認
(???)
• Context Bounds(???)
– 2.7
• class Animal
• class Dog[T]
• implicit object dog extends Dog[Animal]
• class Monkey[T]( implicit dog:Dog[T] )
• new Monkey[Animal]
– 2.8
• class Animal
• class Dog[T]
• implicit object dog extends Dog[Animal]
• class Monkey[T:Dog]
• new Monkey
40.
にはないが追記されてること
Change Logにはないが追記されてること
• 3.7 Type Erasure
– compound typeのerasureについて
• 4.3 Type Declarations and Type Aliases
– Example 4.3.2 Pair をTuple2のAliasとして定義してる例
の として定義してる例
• 4.6 Function Declarations and Definition の最後の節
• 5.1.1 Constructor Invocations
– 6.6.1 Named Parameter に関連して追記
• 5.3.2 Case Classes
メソッド追記
– copyメソッド追記
• 6.6 Function Applications
– call-by-name/call-by-value のくだり変更
• 6.6.1 Named and Default Arguments 追記
• 6.20 Return Expressions
内部無名関数からのreturnの挙動
– 内部無名関数からの の挙動