Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

translate issues-20 #47

Open
wants to merge 1 commit into
base: translated
Choose a base branch
from

Conversation

soulhat
Copy link
Collaborator

@soulhat soulhat commented Jan 20, 2018

No description provided.

@@ -1,394 +1,394 @@
<h1>Ordinary and Exotic Objects Behaviours</h1>
<h1>普通和 exotic 对象行为</h1>
Copy link

@realywithoutname realywithoutname Jan 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

普通和 exotic 对象 => 普通对象和怪异对象的行为
会不会好阅读一些?

<p>In the following algorithm descriptions, assume _O_ is an ordinary object, _P_ is a property key value, _V_ is any ECMAScript language value, and _Desc_ is a Property Descriptor record.</p>
<p>Each ordinary object internal method delegates to a similarly-named abstract operation. If such an abstract operation depends on another internal method, then the internal method is invoked on _O_ rather than calling the similarly-named abstract operation directly. These semantics ensure that exotic objects have their overridden internal methods invoked when ordinary object internal methods are applied to them.</p>
<h1>普通对象内部方法和内部 slot</h1>
<p>所有的普通对象都有一个名为 [[Prototype]] 的内部 slot。这个内部 slot 的值是 *null* 或一个对象,它用来实现继承。[[Prototype]] 对象的数据属性被继承(并作为子对象的属性可见),以便获取访问权限,而不设置访问权限。访问器属性被继承以便获取访问权限和设置访问权限。</p>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的 get 和 set 是值获取和设置值
-> Data properties of the [[Prototype]] object are inherited (and visible as properties of the child object) for the purposes of get access, but not for set access. Accessor properties are inherited for both get access and set access.
-> [[Prototype]] 对象被继承(作为子对象的可见属性)的数据属性只继承 get 访问,而不继承 set 访问。被继承的访问器属性 get 访问和 set 访问都会被继承。

<p>Each ordinary object internal method delegates to a similarly-named abstract operation. If such an abstract operation depends on another internal method, then the internal method is invoked on _O_ rather than calling the similarly-named abstract operation directly. These semantics ensure that exotic objects have their overridden internal methods invoked when ordinary object internal methods are applied to them.</p>
<h1>普通对象内部方法和内部 slot</h1>
<p>所有的普通对象都有一个名为 [[Prototype]] 的内部 slot。这个内部 slot 的值是 *null* 或一个对象,它用来实现继承。[[Prototype]] 对象的数据属性被继承(并作为子对象的属性可见),以便获取访问权限,而不设置访问权限。访问器属性被继承以便获取访问权限和设置访问权限。</p>
<p>每个普通对象都有一个布尔值的 [[Extensible]] 内部 slot,用于控制是否将属性添加到对象。如果 [[Extensible]] 内部 slot 的值为 *false*,则额外的属性不可以被添加到对象。另外,如果 [[Extensible]] 是 *false*,则对象的 [[Prototype]] 内部 slot 的值不可以被修改。一旦对象的 [[Extensible]] 内部 slot 的值被设置为 *false*,则后续不可以将其更改为 *true*。</p>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extensible 是控制对象的可扩展性的, false 表示对象不可扩展,不能添加新属性
-> controls whether or not properties may be added to the object.
-> 控制是否可以将属性添加到对象中。

-> 则对象的 [[Prototype]] 内部 slot 的值不可以被修改。
以下修改会不会便于阅读
-> 则对象内部槽 [[Prototype]] 的值不能被修改。

Copy link

@realywithoutname realywithoutname left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一些小建议

<h1>普通对象内部方法和内部 slot</h1>
<p>所有的普通对象都有一个名为 [[Prototype]] 的内部 slot。这个内部 slot 的值是 *null* 或一个对象,它用来实现继承。[[Prototype]] 对象的数据属性被继承(并作为子对象的属性可见),以便获取访问权限,而不设置访问权限。访问器属性被继承以便获取访问权限和设置访问权限。</p>
<p>每个普通对象都有一个布尔值的 [[Extensible]] 内部 slot,用于控制是否将属性添加到对象。如果 [[Extensible]] 内部 slot 的值为 *false*,则额外的属性不可以被添加到对象。另外,如果 [[Extensible]] 是 *false*,则对象的 [[Prototype]] 内部 slot 的值不可以被修改。一旦对象的 [[Extensible]] 内部 slot 的值被设置为 *false*,则后续不可以将其更改为 *true*。</p>
<p>在以下算法描述中,假设 _O_ 是普通对象,_P_ 是属性键值,_V_ 是任何 ECMAScript 语言值,_Desc_ 是属性描述符记录。</p>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

属性描述符记录 => Property Descriptor record
建议这种专有词汇在翻译过程中不要修改,如果后边需要修改,我们可以统一修改。Property Descriptor record 这是一个规范内使用的类型。

</emu-alg>

<emu-clause id="sec-ordinarysetprototypeof" aoid="OrdinarySetPrototypeOf">
<h1>OrdinarySetPrototypeOf ( _O_, _V_ )</h1>
<p>When the abstract operation OrdinarySetPrototypeOf is called with Object _O_ and value _V_, the following steps are taken:</p>
<p>当用对象 _O_ 和值 _V_ 调用抽象操作 OrdinarySetPrototypeOf 时,将执行以下步骤:</p>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

像这种 “called with Object O and value V“ 翻译为 “以对象 O 和值 V 作为参数调用” 会不会好些呢

1. Else, set _p_ to _p_.[[Prototype]].
1. Set _O_.[[Prototype]] to _V_.
1. Return *true*.
1. 断言:类型(_V_)是对象或类型(_V_)是 Null。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

觉得这种算法没必要翻译,因为算法里面有很多专有名词

</emu-alg>
<emu-note>
<p>The loop in step 8 guarantees that there will be no circularities in any prototype chain that only includes objects that use the ordinary object definitions for [[GetPrototypeOf]] and [[SetPrototypeOf]].</p>
<p>步骤 8 中的循环,确保在任何只包括使用 [[GetPrototypeOf]] [[SetPrototypeOf]] 的普通对象定义的对象原型链中都不会有循环。</p>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The loop in step 8 guarantees that there will be no circularities in any prototype chain that only includes objects that use the ordinary object definitions for [[GetPrototypeOf]] and [[SetPrototypeOf]].
=> 步骤 8 中的循环保证在任何对象的原型链中都不会有循环,其仅包括使用 [[GetPrototypeOf]] 和 [[SetPrototypeOf]] 定义的普通对象。

</emu-alg>
</emu-clause>
</emu-clause>

<!-- es6num="9.1.13" -->
<emu-clause id="sec-objectcreate" aoid="ObjectCreate">
<h1>ObjectCreate ( _proto_ [ , _internalSlotsList_ ] )</h1>
<p>The abstract operation ObjectCreate with argument _proto_ (an object or null) is used to specify the runtime creation of new ordinary objects. The optional argument _internalSlotsList_ is a List of the names of additional internal slots that must be defined as part of the object. If the list is not provided, a new empty List is used. This abstract operation performs the following steps:</p>
<p>具有参数 _proto_ (对象或 null )的抽象操作 ObjectCreate 用于指定新的普通对象的运行时创建。 可选参数 _internalSlotsList_ 是必须定义为对象的一部分的附加内部 slot 名称的列表。如果没有提供列表,则使用新的空列表。 这个抽象操作执行以下步骤:</p>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The abstract operation ObjectCreate with argument proto (an object or null) is used to specify the runtime creation of new ordinary objects.
=> 抽象操作 ObjectCreate 用于运行时创建一个新普通对象,参数为 proto (一个对象或 null)。

</emu-alg>
</emu-clause>
</emu-clause>

<!-- es6num="9.1.13" -->
<emu-clause id="sec-objectcreate" aoid="ObjectCreate">
<h1>ObjectCreate ( _proto_ [ , _internalSlotsList_ ] )</h1>
<p>The abstract operation ObjectCreate with argument _proto_ (an object or null) is used to specify the runtime creation of new ordinary objects. The optional argument _internalSlotsList_ is a List of the names of additional internal slots that must be defined as part of the object. If the list is not provided, a new empty List is used. This abstract operation performs the following steps:</p>
<p>具有参数 _proto_ (对象或 null )的抽象操作 ObjectCreate 用于指定新的普通对象的运行时创建。 可选参数 _internalSlotsList_ 是必须定义为对象的一部分的附加内部 slot 名称的列表。如果没有提供列表,则使用新的空列表。 这个抽象操作执行以下步骤:</p>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The optional argument internalSlotsList is a List of the names of additional internal slots that must be defined as part of the object. If the list is not provided, a new empty List is used.
=> 可选参数 internalSlotsList 是一个包含对象必须定义的额外内部槽名称的 List。如果没有提供,则使用一个空 List。

</emu-alg>
</emu-clause>

<!-- es6num="9.1.14" -->
<emu-clause id="sec-ordinarycreatefromconstructor" aoid="OrdinaryCreateFromConstructor">
<h1>OrdinaryCreateFromConstructor ( _constructor_, _intrinsicDefaultProto_ [ , _internalSlotsList_ ] )</h1>
<p>The abstract operation OrdinaryCreateFromConstructor creates an ordinary object whose [[Prototype]] value is retrieved from a constructor's `prototype` property, if it exists. Otherwise the intrinsic named by _intrinsicDefaultProto_ is used for [[Prototype]]. The optional _internalSlotsList_ is a List of the names of additional internal slots that must be defined as part of the object. If the list is not provided, a new empty List is used. This abstract operation performs the following steps:</p>
<p>抽象操作 OrdinaryCreateFromConstructor 创建一个普通的对象,其 [[Prototype]] 值是从构造函数的 `prototype` 属性中检索的,如果存在的话。否则,由 _intrinsicDefaultProto_ 命名的内在用于 [[Prototype]] 。可选的 _internalSlotsList_ 是必须定义为对象的一部分的附加内部 slot 的名称列表。如果没有提供列表,则使用新的空列表。 这个抽象操作执行以下步骤:</p>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The abstract operation OrdinaryCreateFromConstructor creates an ordinary object whose [[Prototype]] value is retrieved from a constructor's prototype property, if it exists. Otherwise the intrinsic named by intrinsicDefaultProto is used for [[Prototype]].
=> 抽象操作 OrdinaryCreateFromConstructor 创建一个普通的对象,如果构造函数的 prototype 属性存在,其 [[Prototype]] 值为构造函数的 prototype 属性。否则 [[Prototype]] 值为以参数 intrinsicDefaultProto 命名的内部对象。

@dear-lizhihua
Copy link

@realywithoutname 建议加一条规则:超期一定天数不处理的,管理员审核后直接修改后合并。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants