Arrrrrrr
Arrrrrrr

Reputation: 812

Does seq assignment create a new seq copy?

Given tow seqs, a and b, declared like this:

var
  a = @[1, 2, 3]
  b = @[4, 5, 6]

will a = b create a new seq copying everything from b to a or, reuse a? I have problems specially regarding to shallowCopy. I cannot tell what are they doing different.

Upvotes: 3

Views: 717

Answers (1)

zah
zah

Reputation: 5384

The short answer is mostly yes.

The long answer is that sequence assignment is handled by the procs, appearing in the assign module, which is part of the system module. You can search this file for tySequence to see the relevant code.

Upvotes: 2

Related Questions