Hi,

On Thu, Mar 1, 2012 at 11:38 PM, Aaron Patterson
<tenderlove / ruby-lang.org> wrote:
>> Seems that patch would break other subclasses of String, whose
>> initialize_copy doesn't expect whole original string.
>
> When would this happen?

I'm not sure if what Nobu means, but simply calling `initialize_copy`
like in your patch is not sufficient.

Classes expect that instance variables are copied over before the call
to `initialize_copy`.

Indeed, if there is no additional action to take, there is no need to
specialize `initialize_copy`, like in your example with
`@not_translated = true`.

When there is a need to specialize it, classes may rely on instance
variables to be already set. For example, OpenStruct#initialize_copy:

  def initialize_copy(orig)
    super
    @table = @table.dup
    ...
  end

It could of course do `@table = orig.table.dup` instead.

I dislike the idea of adding another hook. I feel the simplest and
best solution is to do a real dup, i.e. copy over the instance
variables and then call `initialize_copy`.