歡迎您光臨本站 註冊首頁

Haxe 4.0 發布,Web 開發語言

←手機掃碼閱讀     admin @ 2019-10-27 , reply:0

Haxe 4.0 已經發布了,Haxe 是一門新興的開源編程語言,是一種開源的編程語言。內容如下:

新的函數類型語法

引入了用於指定函數類型的新語法,現在已經明確地將參數類型與返回類型分離,並支持參數名稱。


(name:String, age:Int)->Bool

arrow function syntax

此版本引入箭頭函數語法。


(a, b) -> a + b

不再支持自定義屬性訪問器

將屬性訪問器類型更改為(set,get),並使用由前綴 get_ 或 set_ 後跟屬性名稱組成的標準 getter/setter 名稱:


class Test {

  @:isVar var myvar(get, set) : String = "Something";

  static function main() {
    trace (new Test().get_myvar());
  }

  public function new() {}

  public function get_myvar() : String { return myvar; }
  public function set_myvar(s:String) : String { return myvar = s; }
}

鍵值迭代器

for 循環語法現在使用新的語法支持在 鍵+值 對上的迭代:


for (key => value in collection) {}

更多詳情見發布說明:

https://community.haxe.org/t/haxe-4-is-released/2102


[admin ]

來源:OsChina
連結:https://www.oschina.net/news/110867/haxe-4-0-released
Haxe 4.0 發布,Web 開發語言已經有344次圍觀

http://coctec.com/news/all/show-post-217818.html