Yusuke Endoh wrote:
> Issue #1711 has been updated by Yusuke Endoh.
> 
> Status changed from Open to Rejected
> 
> Hi,
> 
> In 1.9, proc is called for each node of object tree,
> even if the node is recursive.
> 
>> $ ruby -e 'a=[1]; a << a; Marshal.load(Marshal.dump(a), proc {|e| p e})'
>> 1          # First element
>> [1]        # Second element (recursive node; array itself)
>> [1, [...]] # Generated array
> 
> In 1.8, the recursive node is passed to proc just once.
> 
>> $ ruby -e 'a=[1]; a << a; Marshal.load(Marshal.dump(a), proc {|e| p e})'
>> 1          # First element
>>            # Second element is not called because it is recursive
>> [1, [...]] # Generated array
> 
> According to matz, this is intended spec change.
> 
> There is no problem anywhere.  So I close this ticket.

So, just to make sure I understand:

With this change in 1.9, the proc is called while the recursive object 
is partially constructed, and then again of the same object when it is 
fully constructed? That seems to be what I see here:

$ ruby19  -e 'a=[1]; a << a; Marshal.load(Marshal.dump(a), proc {|e| p 
e; p e.object_id})'
1
3
[3]
14163576
[3, 14163576]
14163576


It seems like it might be nice if the proc were able to distinguish 
these two calls (perhaps a second arg to the proc?). For example, if you 
were keeping a count of the objects, you wouldn't want to double count. 
Or if you were updating a GUI, you would only want to do that once.