Array pointer getter?
Ron Buckton
Ron.Buckton at microsoft.com
Fri Jun 2 17:22:09 UTC 2017
I recently put together https://github.com/rbuckton/ecmascript-ref which is somewhat similar to this.
From: es-discuss [mailto:es-discuss-bounces at mozilla.org] On Behalf Of Alex Falcon
Sent: Friday, June 2, 2017 9:06 AM
To: es-discuss at mozilla.org
Subject: Array pointer getter?
Hello. I heard about SIMD, Atomics, etc. and they accept as first arguments "array, index", so because ES6 have spreads, I suggest to make next things:
let array = [0, 2, 3];
let ptr = array{0}; // don't get value, but pair of [array, 0], also this is proxied which you have setter and getter "value"
let ptr = array.ptr(0); // alternate, functional
ptr.value = 1; // setter
let acceptance = ptr.value; // getter
// also you can just use these pointers without extra indexing
let idx = Atomics.add(...ptr, 1);
It should available for both: typed and regular arrays.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170602/1ab2d8f4/attachment-0001.html>
More information about the es-discuss
mailing list