Hi,

In message "[ruby-talk:15684] Re: Newbie: each!"
    on 01/05/25, Jim Freeze <jim / freeze.org> writes:

|> I'm trying to write an each! iterator that will iterate over an object
|> (specifically, an array) and pass a modifiable reference to its contents, so
|> I can say something like
|>
|>   a=[1,2,3,4,5]
|>   a.each! { |i| i++ } # [2,3,4,5,6]
|
|You can use Array#map! to do this.

Close.  But map! does not pass a modifiable reference, but replaces
the element with the value from the block.

Implementing "modifiable reference" is far harder (and unnatural) in
Ruby than in C++.  I hope Martin can compromise.

							matz.