Re: Array property of custom object

Boris Zbarsky <[email protected]>
Newsgroups gmane.comp.mozilla.devel.jseng
Message-ID <[email protected]>
On 5/2/16 8:07 AM, Mihai Dobrescu wrote:
> So, to be clear, I would expect to have a callback with the index of the array as parameter too... I guess here starts my confusion?

OK.  Can you please back up and clearly describe what you're trying to do?

If your object is `o` and script does `o.arr`, what sort of thing should 
it get?  Should it get an actual JS Array in the Array.isArray() sense? 
  Should it get something that allows indexing into it (more details 
below) but isn't actually an Array?  Something else?

When script does `var x = o.arr[5]`, what should happen? Should the 
value just be read directly out of the storage of `o.arr` (whatever that 
is)? Should some code you control run and allow you to provide the value 
being returned? Something else?

When script does `o.arr[5] = 7`, what should happen?  Should the value 
just be written into the storage of `o.arr` (whatever that is)?  Should 
some code you control run and do something with the value being 
provided?  Something else?

-Boris
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.