留意 2.8版對部份類型小寫別名(Alias)轉譯將移除的提醒

瀏覽次數:1 次
跳到第一則未讀訊息

ChaoYi, Kuo

未讀,
2009年9月10日 下午6:18:592009/9/10
收件者:Scala Fish - 斯卡拉魚
如果你正在觀看當前的 Scala N本書, 或找到教學文, 應該都是目前 2.7 含以前的原文書,
該書或文中若有使用到如下的類型名稱的小寫別名, 請勿再使用, 將在 2.8版本被移除.

原本 Scala 設計是希望替開發者帶來方便, 但這部份卻也造成易誤解.
例如:

object HelloWorld {
def main(args: Array[String]): unit = { .... }

上述的 unit 其實是 scala.Unit 的別名(Alias).

移除清單如下:
(簡單來說, 就是盡可能依 Scala API 文件中的類型來撰寫就對了!)

29 // aliases
------------------------------------------------------------
30
31 @deprecated("lower-case type aliases will be removed") type
byte = scala.Byte
32 @deprecated("lower-case type aliases will be removed") type
short = scala.Short
33 @deprecated("lower-case type aliases will be removed") type
char = scala.Char
34 @deprecated("lower-case type aliases will be removed") type
int = scala.Int
35 @deprecated("lower-case type aliases will be removed") type
long = scala.Long
36 @deprecated("lower-case type aliases will be removed") type
float = scala.Float
37 @deprecated("lower-case type aliases will be removed") type
double = scala.Double
38 @deprecated("lower-case type aliases will be removed") type
boolean = scala.Boolean
39 @deprecated("lower-case type aliases will be removed") type
unit = scala.Unit
40
41 @deprecated("use <code>java.lang.Integer</code> instead")
42 type Integer = java.lang.Integer
43 @deprecated("use <code>java.lang.Character</code> instead")
44 type Character = java.lang.Character

ChaoYi, Kuo

未讀,
2009年9月13日 凌晨12:20:032009/9/13
收件者:Scala Fish - 斯卡拉魚
回覆所有人
回覆作者
轉寄
0 則新訊息