Closed
Bug 630117
Opened 14 years ago
Closed 14 years ago
rename typed array slice() to subarray()
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
People
(Reporter: vlad, Assigned: vlad)
Details
(Keywords: dev-doc-complete, Whiteboard: [softblocker])
Attachments
(2 files, 1 obsolete file)
5.87 KB,
patch
|
Waldo
:
review+
|
Details | Diff | Splinter Review |
5.68 KB,
patch
|
Details | Diff | Splinter Review |
We decided last week that we screwed up with the slice() naming, and changed the name of that function to subset(). We should get this change in, so that we can get a real slice() in the future. (Current slice() creates a new view object, but still references the same underlying data.) Marking this as a softblocker for API consistency, but I'll post a patch tomorrow.
Comment 1•14 years ago
|
||
Why "subset"? There's no sane set-theoretic interpretation. As P. Tucker Withington pointed out, the view objects are like Common Lisp's "Displaced Arrays". Not that you should use that name. "sliceView"?
/be
Assignee | ||
Comment 2•14 years ago
|
||
renamed, and tests updated; also added a test to ensure that subset() behaves as intended (references same buffer).
Assignee: general → vladimir
Attachment #508511 -
Flags: review?
Comment 3•14 years ago
|
||
CC'ing some others who might get broken by this. FYI, gentlemen.
Assignee | ||
Comment 4•14 years ago
|
||
I don't have a good answer as to "why subset", other than that Ken & I liked that name, and it didn't collide with "slice"; the slice wart we should've caught a while ago (and I think Brendan even mentioned it originally :/)
Comment 5•14 years ago
|
||
Wow, "subset" smells pretty funky to me... neither the original array nor the result array is a set. I can see how "slice" could be misleading given that array.slice produces a fresh array. How about "subarray"?
Some of the original work on this kind of API was known as "subsequences" since it was about taking pieces of (possibly mutable) sequence types that share references:
http://portal.acm.org/citation.cfm?id=133234
Seems like a good analogy: subarray : array :: subsequence : sequence. Especially since an array is a kind of sequence.
Dave
Comment 6•14 years ago
|
||
subrange, subview, sharedRange, sharedSlice
Assignee | ||
Comment 7•14 years ago
|
||
I don't think we get to pick a new name at this point... Ken already made the change in WebKit. Cc'ing him here -- really should get some JS folks involved in the typed array work :)
Comment 8•14 years ago
|
||
Fair enough, throwing them out just in case.
As far as JS people getting involved, my understanding is that ECMA is doing its own thing in this space, looking to supplant typed arrays. See comment 575688 comment 6.
Assignee | ||
Comment 9•14 years ago
|
||
Comment on attachment 508511 [details] [diff] [review]
rename slice -> subset
(Argh, I hate that you're not :waldo :-)
Yeah, TC39 is doing its own thing, but we have this now and will likely have it for quite a while... we're already depending on it very heavily for a lot of Fx4 launch demos and the like :-)
Attachment #508511 -
Flags: review? → review?(jwalden+bmo)
Comment 10•14 years ago
|
||
Comment on attachment 508511 [details] [diff] [review]
rename slice -> subset
rs=me assuming it builds and tests out fine.
We should eventually move this over to use the atom stuff and shared const char[] in jsatom.h, but that certainly doesn't need to happen now, nor should it, really.
Attachment #508511 -
Flags: review?(jwalden+bmo) → review+
Comment 11•14 years ago
|
||
Since we've already broken content with the slice -> subset renaming, I suppose if we quickly renamed it again it wouldn't be that bad.
Of the above suggestions, I like subarray the best. There are more view types of ArrayBuffers than just the Typed Arrays, in particular DataView, which doesn't support this operation. Therefore subview doesn't seem appropriate. subrange seems okay, but if we're adding more letters to the method name it seems to me we might as well keep the name focused on the array-like nature of these objects.
Vlad, what do you think?
Comment 12•14 years ago
|
||
"Since we've already broken content with the slice -> subset renaming, I suppose
if we quickly renamed it again it wouldn't be that bad." Let's go 'derper' with the renaming now: http://images0.memegenerator.net/ImageMacro/3784263/we-need-to-go-derper.jpg?imageSize=Medium&generatorName=Inception
Assignee | ||
Comment 13•14 years ago
|
||
If you're ok with an additional rename, subarray sounds fine, or 'subarrayview', but now maybe we're trying too hard.
Comment 14•14 years ago
|
||
+1 on subarray.
(subarrayview is overlong and violates camelCaps -- subarray does not if it's one word, which neologisms and back-formations quickly become, esp. in hacker jargon.)
/be
Comment 15•14 years ago
|
||
If we're in agreement on subarray, I'll update the Typed Array spec and conformance tests and do yet another rename on the WebKit side. Vlad?
Assignee | ||
Comment 16•14 years ago
|
||
sounds good to me, i'll update this patch
Comment 17•14 years ago
|
||
ಠ_ಠ
Assignee | ||
Comment 18•14 years ago
|
||
slice -> subarray!
Attachment #508511 -
Attachment is obsolete: true
Attachment #508837 -
Flags: review?
Assignee | ||
Updated•14 years ago
|
Attachment #508837 -
Flags: review? → review?(jwalden+bmo)
Comment 19•14 years ago
|
||
I hope I don't come back here to see that it's been changed another two times.
Comment 20•14 years ago
|
||
Comment on attachment 508837 [details] [diff] [review]
rename slice -> subarray
rs=me again
Attachment #508837 -
Flags: review?(jwalden+bmo) → review+
Assignee | ||
Comment 21•14 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/84c8b33619e0
death to slice, long live subarray.
Assignee | ||
Comment 22•14 years ago
|
||
argh, the commit comment is wrong; I meant subarray! (code is correct)
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Updated•14 years ago
|
Summary: rename typed array slice() to subset() → rename typed array slice() to subarray()
This turned tests orange. I checked in a attempted fix:
http://hg.mozilla.org/mozilla-central/rev/808970eca6d5
Comment 24•14 years ago
|
||
(In reply to comment #23)
> This turned tests orange. I checked in a attempted fix:
> http://hg.mozilla.org/mozilla-central/rev/808970eca6d5
And the checkin comment/stale bug summary bites. Sicking renamed the calls from slice to subset!
Vlad, can you fix? rs=me
/be
Ugh, didn't realize that the checkin-comment didn't reflect reality. Backed out the whole thing since this has already kept the tree orange for several cycles and my fix was risky enough as I didn't have time to compile a fresh tree and test.
http://hg.mozilla.org/mozilla-central/rev/298c555d0c6e
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
For what it's worth, my patch didn't apparently cover all cases which needed s/slice/subfoo/
Assignee | ||
Comment 27•14 years ago
|
||
Yeah, sorry -- I tested JS, but forgot that the webgl tests had coverage of this :( I have everything patched locally (with correct commit message this time), but refreshing my build to make sure everything's good.
Assignee | ||
Comment 28•14 years ago
|
||
The additional patch.
Assignee | ||
Comment 29•14 years ago
|
||
relanded with additional webgl test fixes.
Status: REOPENED → RESOLVED
Closed: 14 years ago → 14 years ago
Resolution: --- → FIXED
Updated•14 years ago
|
Keywords: dev-doc-needed
Comment 30•14 years ago
|
||
Reminder that this is one that should have gotten a dev-doc-needed keyword on it. :)
That said, documentation has been updated, thanks to Dave Humphrey's blog post catching my eye.
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•