On Sun, 16 Feb 2014, Jürgen Hestermann wrote:

Am 2014-02-16 13:47, schrieb Florian Klämpfl:
setlength does not behave freaky but its behaviour is well designed. The
reason why setlength does a deep copy is simple: multithreading. If
setlength had no deep copy semantics, it would need locking of the whole
array data, not only locked access to the ref. counter.

There may be good reasons for doing it the way it has been done.
But for a programmer (who has not written the compiler) this behaviour is totaly unexpected.
When using unknown features of a programming language for the first time
then the documentaion should tell all aspects in detail and describe the exact behaviour.

It does exactly that, it says:
1) No COW
and I added:
2) SetLength enforces unique ref. count.

Michael.

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to