There's no problem providing indexes to access members of a collection/array object
This a test piece using a direct object (new and del not required) with automatic destruction. This will work with the next o2.
ia.item(15)=42
print ia.item(15)
'2018-10-22
uses RTLobjects
class IntArray
==============
'
%= si sizeof(int)
'
int lbound 'lower limit
int ubound 'upper limit
sys buf 'data buffer
int bytes 'sizeof buffer
'
method Create(int l=0, u=0) as IntArray
=======================================
return.constructor(l,u)
end method
method constructor(int l=0, u=0)
================================
'l lbound
'u ubound
lbound=l
ubound=u
bytes=si*(ubound-lbound+1)
buf=getmemory bytes
end method
'
method destructor()
===================
freememory buf
end method
'
method item(int i,int v) 'INPUT
===============================
'SET
'i index
'v value
int a at buf+(i-lbound)*si
a=v
end method
'
method item(int i) as int 'OUTPUT
=================================
'GET
'i index
int a at buf+(i-lbound)*si
return a
end method
'
method ptr(int i) as sys 'RETURN POINTER
========================================
'GET POINTER
'i index
return buf+(i-lbound)*si
end method
'
method resize(int n) 'RESIZE ARRAY
==================================
'n number of elements
sys bo=buf
int lo=bytes
n*=si
bytes=n
buf=getmemory n
if bytes then
if n<lo then lo=n
copy buf,bo,lo
end if
freememory bo
end method
'
end class
'
'TESTS
======
let ia=Intarray.create(10,20) 'lbound, ubound
'#recordof ia
ia.item(15)=42
ia.resize(100)
print ia.item(15)