`
RednaxelaFX
  • 浏览: 3015075 次
  • 性别: Icon_minigender_1
  • 来自: 海外
社区版块
存档分类
最新评论

ECMAScript 4的一些引用资料/杂记

阅读更多
刚才在es4-discuss看到的:
Graydon 写道
Sure. I can describe the state of most issues as named by the proposals page, I think. Some of the proposals have sort of no-longer-sensible names so I'm going to use the proposals page as a rough guide and name the things that have seemed, in my work, to be separate "features" of the RI.

Implemented, may have bugs:
  - classes and interfaces
  - namespaces
  - pragmas
  - let, const, let-const
  - iterators
  - enumerability control
  - type expressions / definitions / annotations
  - runtime type checks ("standard mode")
  - nullability  - destructuring assignment
  - slice syntax
  - hashcode
  - catchalls
  - map & vector
  - date & time improvements
  - meta objects
  - static generics
  - string trim
  - typeof
  - globals
  - expression closures
  - name objects
  - type operators (is / to / cast / wrap)

Implemented and partly working, but still in flux / work to do:
  - inheritance checking
  - strict mode
  - type parameters
  - structural types
  - numbers & decimal
  - getters & setters (structural part is incomplete)
  - packages

Partially implemented / not yet working:
  - program units
  - generic function
  - updates to unicode
  - updates to regexps

Unimplemented:
  - generators
  - tail calls
  - triple quotes
  - stack inspection
  - reformed with
  - resurrected eval (eval exists but may be wrong)
  - help for the argument object
  - "this function" / "this generator"

In my mind the "high priority" deficits where I actually know what to do are:
  - extending strict mode
  - extending the part of the definer that checks inheritance

The remaining issues on my list all involve some spec/discussion work (units and packages, type parameters, structural typechecks, tail calls, reformed rules for with/this/eval/arguments)

很好,这问题问得好回答得也好。可以更有效的阅读ES4 RI了。

===================================================================

Francis Cheng在他的blog提到了ECMAScript 4中的Vector。内容倒没什么让人感到特别意外的地方,反正C++和Java里都是这么写的了。
Vector的构造器会接受两个参数,第一个是初始长度,第二个是是否为固定长度。所以可以这样构造一个Vector实例:
var intVector:Vector.<int> = new Vector.<int>(7, true)

得到的intVector就是一个长度为7,长度固定的Vector。
Vector有下列几个特性:
  • Vector总是密集的(而不像数组中间可以有空洞)
  • Vector会进行边界检查(例如说不能对一个长度为3的Vector中下标为10的位置赋值)
  • Vector可以是固定长度的
  • Vector有类型参数
  • Vector拥有数组所拥有的方法(例如push(), pop(), slice(), sort()等),并且还有些额外的方法如every(), filter(), indexOf(), some()等。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics