In message "[ruby-talk:00613] Re: Bug in Array#clone!"
on 99/08/11, GOTO Kentaro <gotoken / math.sci.hokudai.ac.jp> writes:
|>I should explain this more in detail; I changed the documents like:
|>
|> dup
|> Returns a newly created array which has the same
|> elements to the receiver. clone returns the complete
|> copy of the original array including freeze status and
|> instance variables. On the other hand, dup copies the
|> array contents only.
|>
|>Or should I copy the instance variables for these classes, and leave
|>documents unchanged?
|
|The latter looks better. It may be easy to see that the defference
|between clone and dup is frozen-property only.
Well, an object can contain information like:
contents: e.g. string, array, hash, etc.
instance variables
freeze status
taint status
some other flags
singleton methods
clone copies all of them.
What information should be copied by dup? Any opinion?
matz.