sequence question

new topic     » topic index » view thread      » older message » newer message

sequence s1, s2
s1 = repeat (0, 1000000) -- s1 is 3.8MB big
s2 = {{}}
s2 [1] = s1

will this last line of code:
1. make copy of s1 into s2 [1]
2. or will it only make pointer to s1?

similar is this:
s2 = {repeat (0, 1000000)}
s1 = s2 [1] -- what happens here?

if it is number 1 then it is waste of memory.
in cases like this i like C more because it is more clear what happens.

i'm asking this because i want to create a library which is not specific for
program. and in this library one sequence1 appears in many different sequences. i
could only have one copy of this sequence1, not many same copies which would
exist in these different sequences. here pointers would be nice.

i would like pointers and structures added to euphoria.
pointers are good because you can identify a variable without having to copy it
in memory. you can do that in euphoria but it's much more complicated. structures
are also possible in euphoria but again not on simple easy way. and structures
are needed in every program.

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu