Referencing Nested Sequences
I am new to Euphoria but find it an exciting language.
One point that bothers me however is as follows -
* to access a sequence nested in a sequence you must make the full
"path" reference each time if you are to change any values
You can not simply copy a reference to the inner sequence - otherwise a
copy of the entire sequence would be made.
e.g for i = 1 to 10 do
nested[9][3][i] = 0
end for
if it done as
SubList = nested[9][3]
for i = 1 to 10 do
SubList[i] = 0
end for
The latter causes a new list to be made - which is not what I want
When the subscripts are CONSTANTS it would be so much more readable to
access the inner element without the full "PATH"
This is also the same when passing the Sub Sequence as a parameter to a
function.
This would be convenient for writing generic sub-functions without them
knowing how the sub-sequence was accesses
In summary it seems that I am forces to accept a significant reduction
to efficiency and less
readability to write the code I intend.
Not also that although I know 'C' pointers would solve this, I would not
want pointers.
Rather I would like a "shorthand" way to access the inner elements - I
would like that interpreter
to handle "shorthand" refereneces without the performance loss of
copying entire sequences
|
Not Categorized, Please Help
|
|