Skip to content

Add a minimal spec - #35

Merged
gsathya merged 5 commits into
masterfrom
spec
Jun 29, 2020
Merged

Add a minimal spec#35
gsathya merged 5 commits into
masterfrom
spec

Conversation

@gsathya

@gsathya gsathya commented Jun 23, 2020

Copy link
Copy Markdown
Member

Loosely based on feedback in #1 and #19

  • Adds a @@slice property on Array.prototype, %TypedArray%.prototype, ArrayBuffer.prototype, SharedArrayBuffer.prototype
  • Aliases this slice property to the existing slice methods on these objects (similar to @@iterator and .values())
  • Does not include Strings because the current String.prototype.slice behavior might not be what you want (see https://mathiasbynens.be/notes/javascript-unicode#other-issues by @mathiasbynens)
  • Does not include the stride argument (at least not yet)
  • Does not allow splice

Fixes #1, fixes #16, fixes #9, fixes #33, fixes #19

@gsathya
gsathya requested review from rbuckton and syg June 23, 2020 21:50

@leobalter leobalter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These are just suggestions for using AssignmentExpression instead of Expression (I also mentioned it at #16).

I'd be fine to address this in a separate PR/issue.

Comment thread spec.emu Outdated
Comment thread spec.emu Outdated
Comment thread spec.emu Outdated
Comment thread spec.emu Outdated
Comment thread spec.emu Outdated
Comment thread spec.emu Outdated
Comment thread spec.emu Outdated
Comment thread spec.emu Outdated

@leobalter leobalter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit picks

Comment thread spec.emu Outdated
Comment thread spec.emu Outdated

@ljharb ljharb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see syntax for obj[x : y], but not for obj?.[x : y], which I'd expect for consistency with optional bracket access.

Comment thread spec.emu
<h1>Properties of the Array Prototype</h1>
<emu-clause id="sec-array.prototype-@@slice">
<h1>Array.prototype [ @@slice ] (start, end)</h1>
<p> The initial value of the @@slice property is the same function object as the initial value of the `Array.prototype.slice` property. </p>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
<p> The initial value of the @@slice property is the same function object as the initial value of the `Array.prototype.slice` property. </p>
<p> The initial value of the @@slice property is %Array.prototype.slice%.</p>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This (and the ones below) are directly copied from the spec text: https://tc39.es/ecma262/#sec-array.prototype-@@iterator

Do you prefer to have different (but more concise) text than the spec? I'm ok with either.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good call; I’ll make a PR to update the spec itself.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In that case, I'll leave this as is (consistent with spec ) for now and update it once the spec is changed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@gsathya this has now been updated in the main spec.

Comment thread spec.emu
<h1>Properties of the %TypedArray.prototype% Object</h1>
<emu-clause id="sec-properties-of-the-%typedarrayprototype%-@@slice">
<h1>%TypedArray%.prototype [ @@slice ] (start, end)</h1>
<p> The initial value of the @@slice property is the same function object as the initial value of the `%TypedArray%.prototype.slice` property. </p>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
<p> The initial value of the @@slice property is the same function object as the initial value of the `%TypedArray%.prototype.slice` property. </p>
<p> The initial value of the @@slice property is `%TypedArray.prototype.slice%`. </p>

Comment thread spec.emu
<h1>Properties of the ArrayBuffer Prototype Object</h1>
<emu-clause id="sec-properties-of-the-arraybuffer-prototype-@@slice">
<h1>ArrayBuffer.prototype [ @@slice ] (start, end)</h1>
<p> The initial value of the @@slice property is the same function object as the initial value of the `ArrayBuffer.prototype.slice` property. </p>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
<p> The initial value of the @@slice property is the same function object as the initial value of the `ArrayBuffer.prototype.slice` property. </p>
<p> The initial value of the @@slice property is `%ArrayBuffer.prototype.slice%`.</p>

Comment thread spec.emu
<h1>Properties of the SharedArrayBuffer Prototype Object</h1>
<emu-clause id="sec-properties-of-the-sharedarraybuffer-prototype-@@slice">
<h1>SharedArrayBuffer.prototype [ @@slice ] (start, end)</h1>
<p> The initial value of the @@slice property is the same function object as the initial value of the `SharedArrayBuffer.prototype.slice` property. </p>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
<p> The initial value of the @@slice property is the same function object as the initial value of the `SharedArrayBuffer.prototype.slice` property. </p>
<p> The initial value of the @@slice property is `%SharedArrayBuffer.prototype.slice%`.</p>

@rbuckton

Copy link
Copy Markdown
Member

@gsathya: This also seems to address the main issue of #19, as I was specifically requesting an @@slice symbol in that issue. There were some additional ideas in that issue, but could be opened as separate issues or as a follow-on proposal.

Comment thread spec.emu Outdated
Comment thread spec.emu Outdated
gsathya and others added 4 commits June 24, 2020 08:05
Co-authored-by: Leo Balter <leonardo.balter@gmail.com>
Change _fromeference_ to _fromReference_

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
@gsathya

gsathya commented Jun 24, 2020

Copy link
Copy Markdown
Member Author

@leobalter, @ljharb, @rbuckton, Thank you for the reviews! I've addressed almost all the comments, please let me know if I missed something.

@hax

hax commented Jul 11, 2020

Copy link
Copy Markdown
Member

README still miss the introduction of @@slice.

@gsathya

gsathya commented Jul 21, 2020

Copy link
Copy Markdown
Member Author

README still miss the introduction of @@slice.

Thanks for the heads up! Filed #38 to track this.

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

Labels

None yet

Projects

None yet

5 participants