-
Notifications
You must be signed in to change notification settings - Fork 4k
GH-39131: [JS] Add at() for array like types #40712
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
Conversation
|
|
|
@trxcllnt and I agreed offline to wrap indexes accesses so that any index is valid. The behavior in js is to only index -length ... length and return undefined otherwise but that seems less consistent than to just always wrap. Also, the types can be composer since we never return undefined. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-1 for renaming get() to at(). I'm fine adding at(), but get() and set() are equivalent to accessing an element by subscript index, e.g. x = xs[0] and xs[0] = x.
We've tried to get rid of them in the past in favor of proxies, but they're still the fastest way to access elements besides enumerating the data directly (via iterators or arraybuffers).
|
I see. So you are saying we should keep the get visitor and just make Isn't |
|
Redone in #40730 |
Simpler version of apache#40712 that preserves `get`. * GitHub Issue: apache#39131
Simpler version of apache#40712 that preserves `get`. * GitHub Issue: apache#39131
Simpler version of apache/arrow#40712 that preserves `get`. * GitHub Issue: #39131
Arrays in JavaScript have
atinstead ofgetso here we are making our arrays more consistent.This PR still maintains support for
getbut deprecates it. We can removegetafter one version of supporting both.atfor array like types #39131