View Single Post
Old 12-14-2011, 12:18 PM   #6
Erriez
Human being with feelings
 
Join Date: Jun 2010
Location: The Netherlands
Posts: 177
Default

The only documentation I found is this link, or do I miss something?

Quote:
Just because JS uses squared brackets doesn't mean their semantic should be the same as in some other language!
I agree, but it should be clearly documented and it's not.

Quote:
How the memory access works is clearly outlined in the documentation, no?
No. The memory access usage doc is maybe clear for you, but not for me:

Quote:
Chapter [ ]
Example: z=x[y]; or x[y]=z;
Example: z=gmem[y]; or gmem[y]=z;
In the first form, you may use brackets to index into memory that is local to your effect. Your effect has approximately 8 million (8,388,608) slots of memory and you may access them either with fixed offsets (i.e. 16811[0]) or with variables (myBuffer[5]). If a value in the brackets is omitted then 0 is used instead.

If 'gmem' is specified (the second form), then instead of local effect memory, the buffer is the global storage buffer, which is approximately 1 million (1,048,576) slots that are shared across all effects.
A simple real practical example is missing in this chapter. I discussed this theoretical text with two independent senior C programmers, but we don't understand it. I've wasted lots of hours debugging to find the right answer, but its still undefined behaviour for me.

Quote:
Squared brackets in JS access the memory at the position calculated from the value before the [] (the offset) plus the value within the [] (the index).
Sorry, we can't follow you: "at the position calculated from the value before the [] (the offset)" What do you mean?

Reaper developers, can you please change this chapter to human readable/practical documentation and spend a few words about 'arrays'? Reaper is made for musicians... not only for advanced programmers of a self-invented script language.
Erriez is offline   Reply With Quote