Upcoming SlideShare
×

# Scala overview

759 views

Published on

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
759
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
4
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Scala overview

1. 1. scala['skeilə] <br />东白<br />
2. 2. scala?<br />OOP<br />FP<br />DSL<br />
3. 3. OOP?<br />数据的抽象化(data abstraction)<br />继承(inheritance)<br />多态(ploymorphism)<br />模块化(module)<br />复用(reuse)<br />类型(type)<br />
4. 4. FP?<br />lambda calculus<br />lambda x . plus x x<br />(lambda x . plus x x) y <br />rule:<br /> alpha – 变量替换<br /> beta – 值应用<br />{lisp[ML/erlang/haskell]}<br />functionisvalue[hightorderfunction];<br /> nosideeffect; lazy evaluation;<br /> pattern match; currying/partial funcitons;<br /> tail recursion optimization; etc…<br />
5. 5. DSL?<br />definition: Domain-Specific Languages/领域特定语言<br />internal DSL<br />便于用库来提供语言特性<br /> easy debug<br /> etc…<br />external DSL<br /> easy design and write[withparser]<br /> newsyntax<br /> etc…<br />
6. 6. not simple?<br /><br />
7. 7. base<br />1.原生类型是对象的实例<br />123.toByte<br />"1".toInt<br />true.toString<br />2.函数也是值<br />val compare = (x: Int, y: Int) => x > y<br />compare(1, 2) // result: Boolean = false<br />3.变量<br />var<br />Val/lazy val<br />4.字面量/literals<br />vali = 1234356; //Int<br />val l = 123454L; // Long<br />val f = 0.123; // Float<br />val c = 'a' or 'u0041'; //Chaar<br />val s = "string" or """ String "ssssss'""" //String<br />val symbol = 'name [scala.Symbol("programming scala") //symbol<br />5.Predef.scala<br />一切操作都是函数<br />一切操作都返回值<br />}=><br />
8. 8.
9. 9. trait<br />
10. 10. companion objects<br />
11. 11. parameterized types<br />invariant/不变: C[T], C is invariant on T<br />如果Tsub或Tsup是T的子类或超类，C[Tsub]或C[Tsup]都不是C[T]类<br />covariant/协变: C[+T], C is covariant on T<br />如果Tsub是T的子类，则C[Tsub]也是C[T]的子类<br />Contravatiant/逆变: C[‐T], C is contravariant on T<br />如果Tsup是T的超类，则C[Tsup]也是C[T]的子类<br />
12. 12. implicit and type bounds<br />
13. 13. function<br />
14. 14. functional data structures<br />
15. 15. pattern match & case class<br />
16. 16. concurrent<br />1.thread<br />2.java.util.concurrent<br />3.event/NIO<br />4.Actor ==><br /><==<br />
17. 17. DSL<br />
18. 18. herding xml in scala<br />
19. 19. ETC…<br />
20. 20. THANKS<br />