2013年2月26日 星期二

code unit 的中文意思

code unit 代碼單元
代碼單元其實就是各種不同編碼中的一個編碼單位,
代碼單元的大小就是編碼的長度。
譬如說 UTF-8的代碼單元是由 8 個位元組成,UTF-16 的代碼單元是由 16 個位元組成。

除此之外,code unit有時候會有另一種解釋,
我把它翻成程式碼區塊,
譬如說一個迴圈區塊,就可以稱之為一段code unit。
很多段區塊 就叫做code units,廢言了...
如果看到code unit,卻很明顯不是在講代碼單元,
那它可能就是代表著一段程式碼區塊。

2013年2月23日 星期六

non-normative 的中文意思

non-normative 非規範性的:

這字眼很常在技術文件中出現,是的技術文件,
為啥技術文件都是英文的>"<。
所謂的非規範性其實指的是,他偏重在描述事情,而不是明確的定義一個規範。
有點像是個guideline,通常比較好閱讀。
而相對的 normative 的部分,就是規範本身的定義,通常比較難讀。
有多難懂,看一下ECMA262對 加法運算子( + )的定義:

The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression is evaluated as follows:
1. Let lref be the result of evaluating AdditiveExpression.
2. Let lval be GetValue(lref).
3. Let rref be the result of evaluating MultiplicativeExpression.
4. Let rval be GetValue(rref).
5. Let lprim be ToPrimitive(lval).
6. Let rprim be ToPrimitive(rval).
7. If Type(lprim) is String or Type(rprim) is String, then
a. Return the String that is the result of concatenating ToString(lprim) followed by ToString(rprim)
8. Return the result of applying the addition operation to ToNumber(lprim) and ToNumber(rprim). See the Note below 11.6.3.

這一大串到底在寫啥 = ="。