Issue #1711 has been updated by Run Paint Run Run.


> 1.9 Marshal.load with proc is incompatible with 1.8, as following:
>
>  * 1.8 load ignores the value returned from proc, whereas 1.9 load
>    replaces the object by the value from proc.
>
>
>  * 1.9 load calls proc for recursively visited data.  1.8 dump only
>    calls proc once.

Thank you for the clarification, matz. I've updated the specs for the first point as I understand it and it seems reasonable. I kind of understand the second point, but am not sure of the implications.

The following example looks to illustrate the difference. 1.8 calls the proc for the first element of the Array, doesn't call it for the second because that's recursive, then calls it again for the entire Array.

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

1.9, however, also calls the proc once for the recursive element, but I don't claim to understand exactly what form the argument takes. In this case it's the data structure containing the recursive element before the recursive element was appended. Is this what's intended? Would this help or hinder rebuilding Marshal'd data?

  $ ruby -e 'a=[1]; a << a; Marshal.load(Marshal.dump(a), proc {|e| p e})'
  1
  [1]
  [1, [...]]
----------------------------------------
http://redmine.ruby-lang.org/issues/show/1711

----------------------------------------
http://redmine.ruby-lang.org