can’t a jit move things around enough that a linked list could be transformed into a memory-backed array if the access pattern requires it.
can’t a jit move things around enough that a linked list could be transformed into a memory-backed array if the access pattern requires it.
depends on the area you’re working in. it’s a pretty important distinction in embedded software.
you can’t spell offset without off. as in fuck.
(affectionate)
if you want my opinion (<- see now you can’t tell me i’m wrong, it’s an opinion) then the difference is that an array is by definition a memory address that’s designated as the beginning of an array, and it’s got an offset because the first element is at that specific address and further items are offset from that address. so you add the offset to the address to get the nth item. a list, meanwhile, can be basically any implementation under the hood, but it’s commonly a linked list. the way you get the nth index there is you count up from the first position. since the implementation is opaque and may be spread out in memory you can’t arithmetic your way to an index, you need to follow the pointers.
java’s arraylist is a list backed by an array. java’s vector is a list backed by a linked list.
i edited my thing, i did start at array.cpp but only found references to other places so i went digging down the stack.
i did look at that but i started out here: https://searchfox.org/firefox-main/source/js/src/vm/ArrayObject.h because it inherits from NativeObject.
hey no you can’t logic your way out of this! i wanted an argument!
i couldn’t actually find any of that in spidermonkey. i was looking in js/vm/arrayobject and its parents, didn’t see any others.
i was thinking between the linked list and the transistors :)
also, i mean… what you might call an array i might call a vector. js arrays allow elements of different types, so they are by definition not arrays in the traditional sense. them being chars internally does make sense in a gross way.
skipped a few steps there i think.
anyway, good question. led me to some cursed code.
the ArrayObject in spidermonkey is an interface to either a TypedArrayObject or a SharedArrayObject. those both have an inner ArrayBuffer object, which is a view into ArrayBufferObjectMaybeShared, which contains a refcounted vector of uint8 pointers, regardless of the datatype. soooo all arrays in javascript are… strings?
it also states in section 6.7.7 (“type names”) that
If the pointer operand points to an element of an array object, and the array is large enough, the result points to an element offset from the original element such that the difference of the subscripts of the resulting and original array elements equals the integer expression.
note also that your example is the only occurrence of the word “index” in the entire document that isn’t just referring to the actual index at the end.
javascript doesn’t have arrays. the backing data structure is a doubly-linked list.
arrays don’t have indices. lists have indices. arrays have offsets.
i’ve seen people do that with vw beetles. it’s cute.


probably the firehose is easier to work with


yeah but git already had those features (well, not discoverability i guess) in its email functionality, it just needs a better ux.


i still don’t understand what it does. it seems to replicate git’s existing distributed patching capabilities using another protocol, tying it to social media profiles instead of crypto keys?
uh-huh